add legend stylings (#3470)
* add legend stylings * fix center and default case
This commit is contained in:
parent
57ba6aa5a9
commit
78f7db138f
@ -183,8 +183,11 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
nothing
|
||||
sp_height > 0 * mm ? push!(axis_opt, "height" => string(axis_height)) :
|
||||
nothing
|
||||
# legend position
|
||||
push!(axis_opt["legend style"], pgfx_get_legend_pos(sp[:legend])...)
|
||||
# legend position / formatting
|
||||
push!(axis_opt["legend style"],
|
||||
pgfx_get_legend_pos(sp[:legend])...
|
||||
)
|
||||
merge!(axis_opt["legend style"], pgfx_get_legend_style(sp))
|
||||
for letter in (:x, :y, :z)
|
||||
if letter != :z || RecipesPipeline.is3d(sp)
|
||||
pgfx_axis!(axis_opt, sp, letter)
|
||||
@ -799,6 +802,14 @@ function pgfx_get_legend_pos(v::Tuple{S,Symbol}) where S <: Real
|
||||
return ("at"=>"$(string(legend_pos_from_angle(v[1],rect...)))", "anchor"=>anchor)
|
||||
end
|
||||
|
||||
function pgfx_get_legend_style(sp)
|
||||
legfont = legendfont(sp)
|
||||
PGFPlotsX.Options(
|
||||
"cells" => PGFPlotsX.Options("anchor" => get((left = "west", right = "east", hcenter = "center"), legfont.halign, "west")),
|
||||
"font" => pgfx_font(legfont.pointsize, pgfx_thickness_scaling(sp))
|
||||
)
|
||||
end
|
||||
|
||||
pgfx_get_colorbar_pos(s) =
|
||||
get((left = " left", bottom = " horizontal", top = " horizontal"), s, "")
|
||||
pgfx_get_colorbar_pos(b::Bool) = ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user