Skip to content

Commit

Permalink
Make stability style configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jun 23, 2018
1 parent 57e6aa3 commit b7f557a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function var_as_index(thing, i)
end

const STYLE = Dict(
:stability => Dict(
# is_stable => plotattributes
true => Dict(:linestyle => :solid, :linecolor => 1),
false => Dict(:linestyle => :dot, :linecolor => 2),
),
:point => Dict(
:default => Dict(
:markersize => 5,
Expand Down Expand Up @@ -129,11 +134,16 @@ end
ix, iy = (var_as_index(sweep, v) for v in vars)
(info, (xs, ys)) = curves_by_stability(sweep, (ix, iy))

# stability => style
style = Dict(
true => Dict(:linestyle => :solid, :linecolor => 1),
false => Dict(:linestyle => :dot, :linecolor => 2),
)
# is_stable => Dict(:linestyle => ?, :linecolor => ?)
style = deepcopy(STYLE[:stability])
# Empty `style` won't work so copying the default... Not ideal.
# TODO: support arbitrary keys, not just linestyle and linecolor
if haskey(bif_style, :stability)
stability_style = bif_style[:stability]
merge!(style[true], get(stability_style, true, Dict()))
merge!(style[false], get(stability_style, false, Dict()))
end

linestyle = []
linecolor = []
for stable in info
Expand Down

0 comments on commit b7f557a

Please sign in to comment.