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
# Return the multigraph and reaction order corresponding to the complex graph. The reaction order is the order of reactions(rn) that would match the edge order given by g.edgeorder.
@@ -95,7 +141,7 @@ function gen_distances(g::MultiGraphWrap; inc = 0.4)
95
141
end
96
142
97
143
"""
98
-
plot_network(rn::ReactionSystem)
144
+
plot_network(rn::ReactionSystem; kwargs...)
99
145
100
146
Converts a [`ReactionSystem`](@ref) into a GraphMakie plot of the species reaction graph
101
147
(or Petri net representation). Reactions correspond to small green circles, and
@@ -110,18 +156,19 @@ Notes:
110
156
rate expression. For example, in the reaction `k*A, B --> C`, there would be a
111
157
red arrow from `A` to the reaction node. In `k*A, A+B --> C`, there would be
112
158
red and black arrows from `A` to the reaction node.
159
+
160
+
For a list of accepted keyword arguments to the graph plot, please see the [GraphMakie documentation](https://graph.makie.org/stable/#The-graphplot-Recipe).
113
161
"""
114
-
function Catalyst.plot_network(rn::ReactionSystem)
115
-
srg =MultiGraphWrap(rn)
162
+
function Catalyst.plot_network(rn::ReactionSystem; kwargs...)
@@ -131,29 +178,38 @@ function Catalyst.plot_network(rn::ReactionSystem)
131
178
edgecolors = [:blackfor i in1:ne(srg)]
132
179
133
180
num_e =ne(srg.g)
181
+
# Handle the rate edges
134
182
for i in1:length(srg.edgeorder)
135
-
if srg.edgeorder[i] > num_e
183
+
# If there are stoichiometry and rate edges from the same species to reaction
184
+
if srg.edgeorder[i] > num_e
136
185
edgecolors[i] =:red
137
186
insert!(edgelabels, i, "")
187
+
elseif edgelabels[i] =="0"
188
+
edgecolors[i] =:red
189
+
edgelabels[i] =""
138
190
end
139
191
end
140
192
193
+
layout =if!haskey(kwargs, :layout)
194
+
is_connected(srg) ?Stress() :Spring()
195
+
end
141
196
graphplot(srg;
197
+
layout,
142
198
edge_color = edgecolors,
143
199
elabels = edgelabels,
144
200
elabels_rotation =0,
145
201
ilabels = ilabels,
146
202
node_color = nodecolors,
147
-
node_size = nodesizes,
148
203
arrow_shift =:end,
149
204
arrow_size =20,
150
205
curve_distance_usage =true,
151
206
curve_distance =gen_distances(srg),
207
+
kwargs...
152
208
)
153
209
end
154
210
155
211
"""
156
-
plot_complexes(rn::ReactionSystem)
212
+
plot_complexes(rn::ReactionSystem; kwargs...)
157
213
158
214
Creates a GraphMakie plot of the [`ReactionComplex`](@ref)s in `rn`. Reactions
159
215
correspond to arrows and reaction complexes to blue circles.
@@ -163,48 +219,39 @@ end
163
219
parameter or a `Number`. i.e. `k, A --> B`.
164
220
- Red arrows from complexes to complexes indicate reactions whose rate
165
221
depends on species. i.e. `k*C, A --> B` for `C` a species.
222
+
223
+
For a list of accepted keyword arguments to the graph plot, please see the [GraphMakie documentation](https://graph.makie.org/stable/#The-graphplot-Recipe).
166
224
"""
167
-
function Catalyst.plot_complexes(rn::ReactionSystem)
168
-
img=incidencematgraph(rn); D =incidencemat(rn; sparse=true)
169
-
specs =species(rn); rxs =reactions(rn)
225
+
function Catalyst.plot_complexes(rn::ReactionSystem; kwargs...)
# Get complex graph and reaction order for edgecolors and edgelabels. rxorder gives the order of reactions(rn) that would match the edge order in edges(cg).
0 commit comments