Fix regression in legend font size setting (#4100)
* take legend font attributes from existing font * "format" file * format remaining files * better in the error box
This commit is contained in:
parent
6c67908a3a
commit
0813b18d69
3
.github/workflows/format_check.yml
vendored
3
.github/workflows/format_check.yml
vendored
@ -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'
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user