-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from EcoJulia/force-dir
🙂 simplify the FD code
- Loading branch information
Showing
15 changed files
with
341 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Node color | ||
|
||
```@setup default | ||
using EcologicalNetworks | ||
using EcologicalNetworksPlots | ||
using Plots | ||
``` | ||
|
||
```@example default | ||
Unes = web_of_life("M_SD_033") | ||
I = initial(BipartiteInitialLayout, Unes) | ||
position!(NestedBipartiteLayout(0.4), I, Unes) | ||
plot(I, Unes, aspectratio=1) | ||
scatter!(I, Unes, bipartite=true, nodefill=degree(Unes), c=:cividis) | ||
``` | ||
|
||
## Node size | ||
|
||
The size of the nodes can be changed using the `nodesize` argument, which is a | ||
dictionary mapping species to values. These values are scaled when making the | ||
figures. Note that in this example we also label the number of the node. | ||
|
||
```@example default | ||
Unes = web_of_life("M_SD_033") | ||
I = initial(BipartiteInitialLayout, Unes) | ||
position!(NestedBipartiteLayout(0.4), I, Unes) | ||
plot(I, Unes, aspectratio=1) | ||
scatter!(I, Unes, bipartite=true, nodesize=degree(Unes)) | ||
``` | ||
|
||
## Node annotations | ||
|
||
```@example default | ||
Unes = web_of_life("M_SD_033") | ||
I = initial(BipartiteInitialLayout, Unes) | ||
position!(NestedBipartiteLayout(0.4), I, Unes) | ||
plot(I, Unes, aspectratio=1) | ||
scatter!(I, Unes, bipartite=true, series_annotations = string.(1:richness(Unes))) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
```@setup default | ||
using EcologicalNetworks | ||
using EcologicalNetworksPlots | ||
using Plots | ||
``` | ||
|
||
One important feature of the package is that the layout can contain *more* nodes | ||
than the network. For example, we can use this to our advantage, to represent | ||
species with a degree larger than 3 in red: | ||
|
||
```@example default | ||
Umod = web_of_life("M_PA_003") | ||
I = initial(RandomInitialLayout, Umod) | ||
for step in 1:4000 | ||
position!(ForceDirectedLayout(2.5, 0.4), I, Umod) | ||
end | ||
plot(I, Umod, aspectratio=1) | ||
scatter!(I, Umod) | ||
N = convert(AbstractUnipartiteNetwork, convert(BinaryNetwork, Umod)) | ||
core3 = collect(keys(filter(p -> p.second == 3, degree(N)))) | ||
plot!(I, N[core3], lc=:red) | ||
scatter!(I, N[core3], mc=:red) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Layouts | ||
|
||
```@docs | ||
BipartiteInitialLayout | ||
NestedBipartiteLayout | ||
``` | ||
|
||
```@setup default | ||
using EcologicalNetworks | ||
using EcologicalNetworksPlots | ||
using Plots | ||
``` | ||
|
||
## Example | ||
|
||
```@example default | ||
Unes = web_of_life("M_SD_033") | ||
I = initial(BipartiteInitialLayout, Unes) | ||
position!(NestedBipartiteLayout(0.4), I, Unes) | ||
plot(I, Unes, aspectratio=1) | ||
scatter!(I, Unes, bipartite=true) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Layouts | ||
|
||
```@docs | ||
CircularInitialLayout | ||
CircularLayout | ||
``` | ||
|
||
```@setup default | ||
using EcologicalNetworks | ||
using EcologicalNetworksPlots | ||
using Plots | ||
``` | ||
|
||
## Example | ||
|
||
```@example default | ||
Unes = web_of_life("M_SD_033") | ||
I = initial(CircularInitialLayout, Unes) | ||
position!(CircularLayout(), I, Unes) | ||
plot(I, Unes, aspectratio=1) | ||
scatter!(I, Unes, bipartite=true) | ||
``` |
Oops, something went wrong.
75a2645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
75a2645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/25289
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: