Gaston: fix legend font

This commit is contained in:
t-bltg 2021-08-01 07:38:28 +02:00 committed by GitHub
parent 204adc3e36
commit af610735eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,7 @@ function gaston_init_subplot(plt::Plot{GastonBackend}, sp::Union{Nothing,Subplot
nothing nothing
end end
function gaston_multiplot_pos_size(layout, parent_xy_wh, level) function gaston_multiplot_pos_size(layout, parent_xy_wh)
nr, nc = size(layout) nr, nc = size(layout)
xy_wh_sp = Array{Any}(nothing, nr, nc) xy_wh_sp = Array{Any}(nothing, nr, nc)
for r 1:nr, c 1:nc # NOTE: col major for r 1:nr, c 1:nc # NOTE: col major
@ -164,7 +164,7 @@ function gaston_multiplot_pos_size(layout, parent_xy_wh, level)
w = layout.widths[c].value * parent_xy_wh[3] w = layout.widths[c].value * parent_xy_wh[3]
h = layout.heights[r].value * parent_xy_wh[4] h = layout.heights[r].value * parent_xy_wh[4]
if l isa GridLayout if l isa GridLayout
sub = gaston_multiplot_pos_size(l, (x, y, w, h), level + 1) sub = gaston_multiplot_pos_size(l, (x, y, w, h))
xy_wh_sp[r, c] = size(sub) == (1, 1) ? only(sub) : sub xy_wh_sp[r, c] = size(sub) == (1, 1) ? only(sub) : sub
else else
xy_wh_sp[r, c] = x, y, w, h, l xy_wh_sp[r, c] = x, y, w, h, l
@ -270,9 +270,7 @@ function gaston_seriesconf!(sp::Subplot{GastonBackend}, series::Series, i::Int)
w: with w: with
=# =#
gsp = sp.o; st = series[:seriestype]; extra = [] gsp = sp.o; st = series[:seriestype]; extra = []
curveconf = String[ curveconf = String[should_add_to_legend(series) ? "title '$(series[:label])'" : "notitle"]
should_add_to_legend(series) ? "title '$(series[:label])'" : "notitle"
]
clims = get_clims(sp, series) clims = get_clims(sp, series)
if st (:scatter, :scatter3d) if st (:scatter, :scatter3d)
@ -444,8 +442,9 @@ function gaston_set_legend!(axesconf, sp, any_label)
for position ("top", "bottom", "left", "right") for position ("top", "bottom", "left", "right")
occursin(position, string(leg)) && push!(axesconf, "set key $position") occursin(position, string(leg)) && push!(axesconf, "set key $position")
end end
push!(axesconf, "set key $(gaston_font(legendfont(sp), rot=false, align=false))")
if sp[:legendtitle] !== nothing if sp[:legendtitle] !== nothing
push!(axesconf, "set key title '$(sp[:legendtitle])' $(gaston_font(legendtitlefont(sp)))") push!(axesconf, "set key title '$(sp[:legendtitle])'")
end end
push!(axesconf, "set key box lw 1 opaque") push!(axesconf, "set key box lw 1 opaque")
push!(axesconf, "set border back") push!(axesconf, "set border back")