diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index 2ccd2b2c..fa627674 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -32,7 +32,6 @@ jobs: if out == "" exit(0) else - @error "Some files have not been formatted !!!" - write(stdout, out) + @error "These files have not been formatted:\n$out" exit(1) end' diff --git a/src/args.jl b/src/args.jl index e7224121..cd7b9690 100644 --- a/src/args.jl +++ b/src/args.jl @@ -1059,13 +1059,13 @@ end """ `default(key)` returns the current default value for that key. - + `default(key, value)` sets the current default value for that key. - + `default(; kw...)` will set the current default value for each key/value pair. - + `default(plotattributes, key)` returns the key from plotattributes if it exists, otherwise `default(key)`. - + """ function default(k::Symbol) k = get(_keyAliases, k, k) @@ -1961,6 +1961,7 @@ function _update_subplot_legend(sp::Subplot, plotattributes_in) k in (:family, :pointsize, :valign, :halign, :rotation, :color) if haskey(plotattributes_in, Symbol(:legend_font_, k)) ) + #! format: off match_attr = NamedTuple( ( lk = Symbol(:legend_font_, k); @@ -1968,9 +1969,12 @@ function _update_subplot_legend(sp::Subplot, plotattributes_in) haskey(_match_map, lk) ? sp[lk] : haskey(plotattributes_in, :legend_font) ? getproperty(plotattributes_in[:legend_font], k) : + haskey(sp.attr, :legend_font) ? + getproperty(sp.attr[:legend_font], k) : default(plotattributes_in, lk) ) for k in (:family, :pointsize, :valign, :halign, :rotation, :color) ) + #! format: on sp.attr[:legend_font] = font(; merge(match_attr, f_attr)...) end diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 8d37aa7a..c09de737 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -17,7 +17,7 @@ const _canvas_map = ( # since we need to know about all the series at the very beginning function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend}) plt.o = UnicodePlots.Plot[] - + up_width = UnicodePlots.DEFAULT_WIDTH[] up_height = UnicodePlots.DEFAULT_HEIGHT[] diff --git a/test/test_defaults.jl b/test/test_defaults.jl index 6ad49077..e9abd345 100644 --- a/test/test_defaults.jl +++ b/test/test_defaults.jl @@ -76,6 +76,11 @@ end # testset @test p[1][:legend_background_color] == RGBA{Float64}(0.0, 1.0, 1.0, 1.0) @test p[1][:legend_foreground_color] == RGBA{Float64}(0.0, 0.5019607843137255, 0.0, 1.0) + #remember settings + plot(legend_font_pointsize = 20) + sp = plot!(label = "R")[1] + @test Plots.legendfont(sp).pointsize == 20 + #setting whole font sp = plot( 1:5,