From b23c620d77611d7ef5b295d33255e61308804230 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 09:56:31 +0100 Subject: [PATCH] Format .jl files [skip ci] (#3941) Co-authored-by: t-bltg --- src/args.jl | 25 ++++++++++++++++--------- test/test_defaults.jl | 7 ++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/args.jl b/src/args.jl index c7f083fe..1dbf185a 100644 --- a/src/args.jl +++ b/src/args.jl @@ -1483,8 +1483,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW) end # fonts - for fontname in - (:titlefont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont) + for fontname in (:titlefont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont) args = RecipesPipeline.pop_kw!(plotattributes, fontname, ()) for arg in wraptuple(args) processFontArg!(plotattributes, fontname, arg) @@ -1948,14 +1947,22 @@ function _update_subplot_colors(sp::Subplot) end function _update_subplot_legend(sp::Subplot, plotattributes_in) - f_attr = NamedTuple( k => plotattributes_in[Symbol(:legend_font_, k)] for k in (:family, :pointsize, :valign, :halign, :rotation, :color) if haskey(plotattributes_in, Symbol(:legend_font_, k))) - match_attr = NamedTuple( (lk = Symbol(:legend_font_, k); k => haskey(_match_map, lk) ? sp[lk] : - haskey(plotattributes_in, :legend_font) ? getproperty(plotattributes_in[:legend_font], k) : - default(plotattributes_in, lk)) - for k in (:family, :pointsize, :valign, :halign, :rotation, :color)) - sp.attr[:legend_font] = font(; - merge(match_attr, f_attr)... + f_attr = NamedTuple( + k => plotattributes_in[Symbol(:legend_font_, k)] for + k in (:family, :pointsize, :valign, :halign, :rotation, :color) if + haskey(plotattributes_in, Symbol(:legend_font_, k)) ) + match_attr = NamedTuple( + ( + lk = Symbol(:legend_font_, k); + k => + haskey(_match_map, lk) ? sp[lk] : + haskey(plotattributes_in, :legend_font) ? + getproperty(plotattributes_in[:legend_font], k) : + default(plotattributes_in, lk) + ) for k in (:family, :pointsize, :valign, :halign, :rotation, :color) + ) + sp.attr[:legend_font] = font(; merge(match_attr, f_attr)...) end function _update_axis( diff --git a/test/test_defaults.jl b/test/test_defaults.jl index a62ca9ad..2f1971f5 100644 --- a/test/test_defaults.jl +++ b/test/test_defaults.jl @@ -69,7 +69,12 @@ end # testset @test p[1][:legend_foreground_color] == RGBA{Float64}(0.0, 0.5019607843137255, 0.0, 1.0) #setting whole font - sp = plot(1:5, legendfont=font(12), legend_font_halign = :left, foreground_color_subplot = :red)[1] + sp = plot( + 1:5, + legendfont = font(12), + legend_font_halign = :left, + foreground_color_subplot = :red, + )[1] @test Plots.legendfont(sp).pointsize == 12 @test Plots.legendfont(sp).halign == :left # match mechanism