-
-
Notifications
You must be signed in to change notification settings - Fork 80
Support CairoMakie above 0.13 #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3bd7211
b271c29
ac63906
458f589
87809ab
dd91970
40f53b8
ef6e150
a09d69b
dc85702
bd4a7ac
59a6d26
b1f6e0e
65e0020
56b66ca
1b837e1
5bc392f
6dc2e41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,37 +232,49 @@ with the rate constant for the reaction. | |
|
|
||
| For a list of accepted keyword arguments to the graph plot, please see the [GraphMakie documentation](https://graph.makie.org/stable/#The-graphplot-Recipe). | ||
| """ | ||
| function Catalyst.plot_complexes(rn::ReactionSystem; show_rate_labels = false, kwargs...) | ||
| function Catalyst.plot_complexes(rn::ReactionSystem; show_rate_labels::Bool = false, kwargs...) | ||
| rxs = reactions(rn) | ||
| specs = species(rn) | ||
| edgecolors = [:black for i in 1:length(rxs)] | ||
| edgelabels = [repr(rx.rate) for rx in rxs] | ||
|
|
||
| deps = Set() | ||
| for (i, rx) in enumerate(rxs) | ||
| empty!(deps) | ||
| get_variables!(deps, rx.rate, specs) | ||
| (!isempty(deps)) && (edgecolors[i] = :red) | ||
| end | ||
|
|
||
| # 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). | ||
| cg, rxorder = ComplexGraphWrap(rn) | ||
|
|
||
| layout = if !haskey(kwargs, :layout) | ||
| Stress() | ||
| end | ||
| f = graphplot(cg; | ||
| layout, | ||
| edge_color = edgecolors[rxorder], | ||
| elabels = show_rate_labels ? edgelabels[rxorder] : [], | ||
| ilabels = complexlabels(rn), | ||
| node_color = :skyblue3, | ||
| elabels_rotation = 0, | ||
| arrow_shift = :end, | ||
| curve_distance_usage = true, | ||
| curve_distance = gen_distances(cg), | ||
| kwargs... | ||
| ) | ||
|
|
||
| if show_rate_labels | ||
| edgelabels = [repr(rxs[i].rate) for i in rxorder] | ||
| deps = Set() | ||
| edgecolors = map(rxorder) do i | ||
| empty!(deps) | ||
| get_variables!(deps, rxs[i].rate, specs) | ||
| return isempty(deps) ? :black : :red | ||
| end | ||
|
|
||
| f = graphplot(cg; | ||
| layout, | ||
| edge_color = edgecolors, | ||
| elabels = edgelabels, | ||
| ilabels = complexlabels(rn), | ||
| node_color = :skyblue3, | ||
| elabels_rotation = 0, | ||
| arrow_shift = :end, | ||
| curve_distance_usage = true, | ||
| curve_distance = gen_distances(cg), | ||
| kwargs... | ||
| ) | ||
| else | ||
| f = graphplot(cg; | ||
| layout, | ||
| ilabels = complexlabels(rn), | ||
| node_color = :skyblue3, | ||
| arrow_shift = :end, | ||
| curve_distance_usage = true, | ||
| curve_distance = gen_distances(cg), | ||
| kwargs... | ||
| ) | ||
| end | ||
|
Comment on lines
+267
to
+277
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait, isn't this is changing the graph complex plotting? Colors were always used before to distinguish the edge types, but now it seems to only use them when labels are used. These were not intended to be tied together.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch |
||
|
|
||
| f.axis.xautolimitmargin = (0.15, 0.15) | ||
| f.axis.yautolimitmargin = (0.15, 0.15) | ||
|
|
||
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.
This is not true anymore, right? I.e. the animation does not seem to do anything anymore?
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.
This is still correct.
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.
This is still correct.
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.
This is still correct.