Clarifying the behavior of "PLOTS_DEFAULTS" in Plots.jl

I’d like to set some default parameters for plotting using Plots.jl by defining the “PLOTS_DEFAULTS” variable in my “startup.jl” . I have questions regarding its behavior:

  1. It appears that setting “PLOTS_DEFAULTS” successfully applies my default parameters, and subsequent calls to the “plot()” function respect these settings. However, if I execute the “default()” function, all parameters revert to Plots.jl’s built-in defaults, and my custom “PLOTS_DEFAULTS” settings are lost. Is this the intended behavior? I expected that defining “PLOTS_DEFAULTS” would change the “defaults” themselves, but it seems that the “default()” function does not consider “PLOTS_DEFAULTS” .

  2. Given the behavior described above, how can I have my custom parameters defined in “PLOTS_DEFAULTS” re-effective after executing the “default()” function?

  3. I want to specify margins (such as “top_margin” ) through “PLOTS_DEFAULTS” . Is it possible to set, for example, a 5mm top margin when mm is not available? I don’t want to load a package in my startup.jl just for this.

It’s not documented so I suppose it’s free to change, but the first line of the 0-positional argument method does suggest it resets the defaults if reset=true and there are no other keyword arguments for setting default values:

function default(; reset = true, kw...)
    (reset && isempty(kw)) && reset_defaults()
    kw = KW(kw)
    Plots.preprocess_attributes!(kw)
    for (k, v) in kw
        default(k, v) # 2-positional method sets 1 default value for 1 key
    end
end

Honestly not sure why it’s designed like that because:

  1. typical usage with keyword arguments would not reset, so I’d expect zero arguments to not reset either (a no-op overall)
  2. I might want to the one call to reset the defaults before I set new values.