How to know which plotting backend is in use?

I know how to switch between backends following the Plots tutorial. Is there a way to check which backend is in use? Didn’t search the tutorial carefully. Thanks in advance for a pointer if I’ve missed it …

Just realized backend() does the job.


Each time I restart Julia or reload Plots, the default backend is always set back to GR, which is never my first choice. Is there a way that I can set another backend, e.g. PyPlot, as default without removing GR? Thanks!

put something like

ENV["PLOTS_DEFAULT_BACKEND"] = my_favorite_backend

in your ~/.juliarc.jl.


Thanks! I tried what you suggested and when restarted Julia, the following error was thrown:

chobbes@chobbes-XPS-15-9550:~/juliapro/JuliaPro-$ ./julia
ERROR: LoadError: UndefVarError: pyplot not defined
 [1] include_from_node1(::String) at ./loading.jl:569
 [2] include(::String) at ./sysimg.jl:14
 [3] try_include at ./client.jl:244 [inlined]
 [4] load_juliarc() at ./client.jl:321
 [5] process_options(::Base.JLOptions) at ./client.jl:275
 [6] _start() at ./client.jl:371
while loading /home/chobbes/.juliarc.jl, in expression starting on line 12

I must have missed something. Btw, I tried all possible capitalization or camel cases. Any clud?

Did you use a string on the right-hand side?

1 Like

Thanks for reminding. I totally forgot quotes.