I am trying to save plots of simulations I am running. Here is the code:
p1 = plot(sim, layout=(1,3), linealpha=0.9,color=[:blue :red :green], size = [1200,400])
p2 = plot!(sol, layout=(1,3), linealpha=1,lw=3.0,color=[:black :black :black],title=“”, size = [1200,400])
plot(p1)
savefig(p1, “test.png”)
And I get the following error:
ERROR: UndefVarError: savefig not defined
Stacktrace:
[1] _show(io::IOStream, #unused#::MIME{Symbol(“image/png”)}, plt::Plots.Plot{Plots.PlotlyBackend})
@ Plots ~/.julia/packages/Plots/1KWPG/src/backends/plotlybase.jl:21
[2] show
@ ~/.julia/packages/Plots/1KWPG/src/output.jl:212 [inlined]
[3] #269
@ ~/.julia/packages/Plots/1KWPG/src/output.jl:6 [inlined]
[4] open(::Plots.var"#269#270"{Plots.Plot{Plots.PlotlyBackend}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:330
[5] open
@ ./io.jl:328 [inlined]
[6] png(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
@ Plots ~/.julia/packages/Plots/1KWPG/src/output.jl:5
[7] savefig(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
@ Plots ~/.julia/packages/Plots/1KWPG/src/output.jl:121
[8] top-level scope
@ ~/Param/parallel.jl:83
Now if I delete
savefig(p1, “test.png”)
then I am able to get a plot and then can save but only as a .svg file.
I am using the PlotlyBase backend.
EDIT: now I can get it to save but it is empty when i try to open it. Moreover, why when I save it does it not also open the plot in the plots pane.