I find that for certain packages there are things I do everytime I am using the package.
For example, in Plots.jl I usually set the default linewidth to 2 via
Is there some way to set my Julia environment up so that everytime I load plots via
using Plots, I will automatically run
default(linewidth=2) as well?
Another important thing would be enabling compiled execution for functions from Base when using Debugger.jl. VSCode does this by default, and it would be nice to make my REPL do the same by default.
I am aware of the startup.jl file, but I don’t want to load Plots.jl and Debugger.jl in every REPL session.
As explained on stackoverflow and in the Plots documentation, you can simply add:
PLOTS_DEFAULTS = Dict(:linewidth => 2)
More generally, even if Plots.jl didn’t support such a convenient mechanism for overriding defaults, you could create a mini-package MyPlots of the form:
@reexport using Plots
and then do
using MyPlots instead of
using Plots in order to load Plots with whatever custom initialization you want.
I saw your first suggestion as a solution on another discourse post, but I misunderstood and thought that I was then supposed to supply
PLOTS_DEFAULTS as an argument to each plotting call, which would be cumbersome.