diff --git a/src/init.jl b/src/init.jl index 0c431963..efa41cd9 100644 --- a/src/init.jl +++ b/src/init.jl @@ -15,9 +15,10 @@ end function __init__() user_defaults = _plots_defaults() if haskey(user_defaults, :theme) - theme(pop!(user_defaults, :theme)) + theme(pop!(user_defaults, :theme); user_defaults...) + else + default(; user_defaults...) end - default(; user_defaults...) insert!(Base.Multimedia.displays, findlast(x -> x isa Base.TextDisplay || x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotsDisplay()) diff --git a/test/runtests.jl b/test/runtests.jl index 4e4ba79c..4daff777 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,7 @@ import GeometryTypes, GeometryBasics using Dates using RecipesBase +include("test_defaults.jl") include("test_axes.jl") include("test_axis_letter.jl") include("test_recipes.jl") diff --git a/test/test_defaults.jl b/test/test_defaults.jl new file mode 100644 index 00000000..96c0ac44 --- /dev/null +++ b/test/test_defaults.jl @@ -0,0 +1,11 @@ +using Plots, Test + +const PLOTS_DEFAULTS = Dict(:theme => :wong2) +Plots.__init__() + +@testset "Loading theme" begin + @test plot(1:5)[1][1][:seriescolor] == RGBA(colorant"black") +end + +empty!(PLOTS_DEFAULTS) +Plots.__init__()