add title_location

This commit is contained in:
Simon Christ 2020-03-18 11:31:49 +01:00
parent e1325f7428
commit 62aca48a74

View File

@ -104,7 +104,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
end end
for sp in plt.subplots for sp in plt.subplots
bb = bbox(sp) bb = sp.plotarea
sp_width = width(bb) sp_width = width(bb)
sp_height = height(bb) sp_height = height(bb)
dx, dy = bb.x0 dx, dy = bb.x0
@ -117,14 +117,24 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
fg_alpha = alpha(plot_color(sp[:foreground_color_legend])) fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
title_cstr = plot_color(sp[:titlefontcolor]) title_cstr = plot_color(sp[:titlefontcolor])
title_a = alpha(title_cstr) title_a = alpha(title_cstr)
title_loc = sp[:title_location]
bgc_inside = plot_color(sp[:background_color_inside]) bgc_inside = plot_color(sp[:background_color_inside])
bgc_inside_a = alpha(bgc_inside) bgc_inside_a = alpha(bgc_inside)
axis_opt = PGFPlotsX.Options( axis_opt = PGFPlotsX.Options(
"title" => sp[:title], "title" => sp[:title],
"title style" => PGFPlotsX.Options( "title style" => PGFPlotsX.Options(
"font" => pgfx_font( "at" => if title_loc == :left
sp[:titlefontsize], "{(0,1)}"
pgfx_thickness_scaling(sp), elseif title_loc == :right
"{(1,1)}"
elseif title_loc isa Tuple
"{$(string(title_loc))}"
else
"{(0.5,1)}"
end,
"font" => pgfx_font(
sp[:titlefontsize],
pgfx_thickness_scaling(sp),
), ),
"color" => title_cstr, "color" => title_cstr,
"draw opacity" => title_a, "draw opacity" => title_a,