Is it necessary to add GR.jl?

GR is the default backend for plotting and works out of the box. Hence, the question, is it necessary to add GR.jl via Pkg.add? Would this add any extra capabilities to plotting?

Nope, GR is a dependency of Plots, so when you install the latter, the former is installed automatically. Unless you need to use GR directly there is no need to add it yourself.

1 Like

I see, adding/using/importing GR would simply give me the ability of accessing the exported names. Am I right?

Something I don’t get is, if GR.jl is a dependency of Plots.jl and the former is installed when the latter is added, why using GR returns Package GR not found, but a package named GR is available from a registry.?

Because (unlike say python) you can only import packages you have explicitly added to your project. This is necessary for Julia to track dependencies effectively and ensure you always have a compatible set of packages installed.

For example, if you were allowed to use GR without adding it, then if a future version of Plots decides to change its default backend and no longer depend on GR then when you update Plots your own project will break because GR is no longer there.

2 Likes