11using Plots, Latexify
22import Plots. plot, Plots. plot!; export plot, plot!, plot_phase_diagram, savefig
33
4- function _set_Plots_default ()
5- font = " Computer Modern"
6- default (linewidth= 2 , legend= :outerright )
7- default (fontfamily= font, titlefont= font , tickfont= font)
8- end
4+ const _set_Plots_default = Dict {Symbol, Any} ([
5+ :fontfamily => " computer modern" ,
6+ :titlefont => " computer modern" ,
7+ :tickfont => " computer modern" ,
8+ :linewidth => 2 ,
9+ :legend => :outerright ])
10+
11+
912
1013dim (res:: Result ) = length (size (res. solutions)) # give solution dimensionality
1114
@@ -40,11 +43,10 @@ default behaviour: plot stable solutions as full lines, unstable as dashed
4043the x and y axes are taken automatically from `res`
4144"""
4245function plot (res:: Result , varargs... ; kwargs... ):: Plots.Plot
43- HarmonicBalance. _set_Plots_default ()
4446 if dim (res) == 1
45- plot1D (res, varargs... ; kwargs... )
47+ plot1D (res, varargs... ; _set_Plots_default ... , kwargs... )
4648 elseif dim (res) == 2
47- plot2D (res, varargs... ; kwargs... )
49+ plot2D (res, varargs... ; _set_Plots_default ... , kwargs... )
4850 else
4951 error (" Data dimension " , dim (res), " not supported" )
5052 end
@@ -56,9 +58,9 @@ $(TYPEDSIGNATURES)
5658
5759Similar to `plot` but adds a plot onto an existing plot.
5860"""
59- plot! (res:: Result , varargs... ; kwargs... ):: Plots.Plot = plot (res, varargs ... ; add = true , kwargs ... )
60-
61-
61+ function plot! (res:: Result , varargs... ; kwargs... ):: Plots.Plot
62+ plot (res, varargs ... ; add = true , _set_Plots_default ... , kwargs ... )
63+ end
6264"""
6365$(TYPEDSIGNATURES)
6466
@@ -105,7 +107,7 @@ function plot1D(res::Result; x::String="default", y::String, class="default", no
105107
106108 if class == " default"
107109 if not_class == [] # plot stable full, unstable dashed
108- p = plot1D (res; x= x, y= y, class= [" physical" , " stable" ], kwargs... )
110+ p = plot1D (res; x= x, y= y, class= [" physical" , " stable" ], add = add, kwargs... )
109111 plot1D (res; x= x, y= y, class= " physical" , not_class= " stable" , add= true , style= :dash , kwargs... )
110112 return p
111113 else
@@ -167,11 +169,10 @@ Class selection done by passing `String` or `Vector{String}` as kwarg:
167169Other kwargs are passed onto Plots.gr()
168170"""
169171function plot_phase_diagram (res:: Result ; kwargs... ):: Plots.Plot
170- _set_Plots_default ()
171172 if dim (res) == 1
172- plot_phase_diagram_1D (res; kwargs... )
173+ plot_phase_diagram_1D (res; _set_Plots_default ... , kwargs... )
173174 elseif dim (res) == 2
174- plot_phase_diagram_2D (res; kwargs... )
175+ plot_phase_diagram_2D (res; _set_Plots_default ... , kwargs... )
175176 else
176177 error (" Data dimension " , dim (res), " not supported" )
177178 end
0 commit comments