You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/model_creation/model_visualisation.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,34 +88,36 @@ In this section we demonstrate some of the ways that plot objects can be manipul
88
88
f, ax, p = plot_complexes(brusselator, show_rate_labels = true)
89
89
```
90
90
91
-
It seems like a bit of the top node is cut off. Let's hide the tick marks and grid and increase the top and bottom margins by increasing `yautolimitmargin`.
91
+
It seems like a bit of the top node is cut off. Let's show the tick marks and grid and increase the top and bottom margins by increasing `yautolimitmargin`.
92
92
```@example visualisation_graphs
93
-
hidedecorations!(ax)
93
+
showdecorations!(ax)
94
94
ax.yautolimitmargin = (0.1, 0.1) # defaults to (0.05, 0.05)
95
95
ax.aspect = DataAspect()
96
+
display(F)
96
97
```
97
98
98
-
There are many keyword arguments that can be passed to `plot_network` or `plot_complexes` to change the look of the graph (which get passed to the `graphplot` Makie recipe). Let's change the color of the nodes and make the inner labels a bit smaller. As before, we hide the tick marks and grid. Let's also give the plot a title.
99
+
There are many keyword arguments that can be passed to `plot_network` or `plot_complexes` to change the look of the graph (which get passed to the `graphplot` Makie recipe). Let's change the color of the nodes and make the inner labels a bit smaller. Let's also give the plot a title.
ax.yautolimitmargin = (0.1, 0.1) # defaults to (0.05, 0.05)
103
102
ax.aspect = DataAspect()
104
103
ax.title = "Brusselator"
104
+
display(f)
105
105
```
106
106
107
107
Most of the kwargs that modify the nodes or edges will also accept a vector with the same length as the number of nodes or edges, respectively. See [here](https://graph.makie.org/stable/#The-graphplot-Recipe) for a full list of keyword arguments to `graph_plot`. Note that `plot_complexes` and `plot_network` default to `layout = Stress()` rather than `layout = Spring()`, since `Stress()` is better at generating plots with fewer edge crossings. More layout options and customizations (such as pinning nodes to certain positions) can be found in the [`NetworkLayout` documentation](https://juliagraphs.org/NetworkLayout.jl/stable/).
108
108
109
109
Once a graph is already created we can also change the keyword arguments by modifying the fields of the `Plot` object `p`.
110
110
```@example visualisation_graphs
111
111
p.node_color = :orange
112
+
display(f)
112
113
```
113
114
114
115
Custom node positions can also be given, if the automatic layout is unsatisfactory.
115
116
```@example visualisation_graphs
116
117
fixedlayout = [(0,0), (1,0), (0,1), (1,1), (2,0)]
117
118
p.layout = fixedlayout
118
119
autolimits!(ax)
120
+
display(f)
119
121
```
120
122
121
123
Makie graph plots can be made to be interactive, allowing one to drag nodes and edges. To do this, we retrieve the axis from the GraphMakie plot, and then register the interactions. **Note that this can only be done if `GLMakie` is the installed Makie backend. See the [GraphMakie docs](https://graph.makie.org/stable/#Predefined-Interactions) for more information about the types of interactions one can register.** Below is a non-interactive code example that shows how to do this:
0 commit comments