I want to plot a figure using all backends. I do this:
function plots_all_formats()
plots("png")
plots("html")
plots("svg")
end
function plots(format)
# load data
# ...
if format == "html"
plotlyjs() # plotlyjs can export interactive plots in html
elseif format == "svg"
pyplot() # pyplot has better svg export
else # gr is the quickest renderer and is perfect for pngs
gr()
end
plot_function(format, data) # makes the plot and pass it to print_output
end
function print_output(path, p, format)
savefig(p, joinpath(PLOTS_PATH, path*"."*format))
end
But it seems that the backend takes some time to change and I do not get reproducible results. Sometimes I get errors like broken pipe
or ERROR: only png or svg allowed. got: :html
but it does work when I do it manually in the REPL. Did someone encountered the same problem?