Fix yshift of subplots.

Calculation of coordinate transformation from bb to pgf did not consider the
height of the plot.
This commit is contained in:
Sebastian Pech 2017-01-23 13:56:40 +01:00
parent bcd5d9ef90
commit caf86686dd

View File

@ -249,8 +249,12 @@ end
function _update_plot_object(plt::Plot{PGFPlotsBackend}) function _update_plot_object(plt::Plot{PGFPlotsBackend})
plt.o = PGFPlots.Axis[] plt.o = PGFPlots.Axis[]
# Obtain the total height of the plot by extracting the maximal bottom
# coordinate from the bounding box.
# TODO: Maybe there is a better way to get the total height of the plot.
total_height = maximum([bottom(bbox(sp)) for sp in plt.subplots])
for sp in plt.subplots for sp in plt.subplots
# first build the PGFPlots.Axis object # first build the PGFPlots.Axis object
style = ["unbounded coords=jump"] style = ["unbounded coords=jump"]
kw = KW() kw = KW()
@ -268,7 +272,7 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
bb = bbox(sp) bb = bbox(sp)
push!(style, """ push!(style, """
xshift = $(left(bb).value)mm, xshift = $(left(bb).value)mm,
yshift = $((height(bb) - (bottom(bb))).value)mm, yshift = $((total_height - (bottom(bb))).value)mm,
axis background/.style={fill=$(pgf_color(sp[:background_color_inside])[1])} axis background/.style={fill=$(pgf_color(sp[:background_color_inside])[1])}
""") """)
kw[:width] = "$(width(bb).value)mm" kw[:width] = "$(width(bb).value)mm"