What is the difference between `using Plots; gr()` and "using GR"?

Dear all,

we can use GR backend,

using Plots
gr()

we can also directly use

using GR

So what is the difference between two kinds of code?

Plots.jl is a package that provides a standard interface to various plotting libraries, among them GR.

So in the end you may be able to do the same things but the syntax to achieve the same thing using GR will be different than what you need to write if you use using Plots. The difference is that if you write it using Plots.jl you can just switch your plotting library and the same code will work for the other backends.

That, and plot recipes defined in other packages will work with Plots, but not with GR

1 Like