Format .jl files [skip ci] (#3941)

Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2021-11-15 09:56:31 +01:00 committed by GitHub
parent 21c3ac4c45
commit b23c620d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions

View File

@ -1483,8 +1483,7 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
end end
# fonts # fonts
for fontname in for fontname in (:titlefont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont)
(:titlefont, :legendtitlefont, :plot_titlefont, :colorbar_titlefont)
args = RecipesPipeline.pop_kw!(plotattributes, fontname, ()) args = RecipesPipeline.pop_kw!(plotattributes, fontname, ())
for arg in wraptuple(args) for arg in wraptuple(args)
processFontArg!(plotattributes, fontname, arg) processFontArg!(plotattributes, fontname, arg)
@ -1948,14 +1947,22 @@ function _update_subplot_colors(sp::Subplot)
end end
function _update_subplot_legend(sp::Subplot, plotattributes_in) 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))) f_attr = NamedTuple(
match_attr = NamedTuple( (lk = Symbol(:legend_font_, k); k => haskey(_match_map, lk) ? sp[lk] : k => plotattributes_in[Symbol(:legend_font_, k)] for
haskey(plotattributes_in, :legend_font) ? getproperty(plotattributes_in[:legend_font], k) : k in (:family, :pointsize, :valign, :halign, :rotation, :color) if
default(plotattributes_in, lk)) haskey(plotattributes_in, Symbol(:legend_font_, k))
for k in (:family, :pointsize, :valign, :halign, :rotation, :color))
sp.attr[:legend_font] = font(;
merge(match_attr, f_attr)...
) )
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 end
function _update_axis( function _update_axis(

View File

@ -69,7 +69,12 @@ end # testset
@test p[1][:legend_foreground_color] == RGBA{Float64}(0.0, 0.5019607843137255, 0.0, 1.0) @test p[1][:legend_foreground_color] == RGBA{Float64}(0.0, 0.5019607843137255, 0.0, 1.0)
#setting whole font #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).pointsize == 12
@test Plots.legendfont(sp).halign == :left @test Plots.legendfont(sp).halign == :left
# match mechanism # match mechanism