sp_bbox -> inset_bbox

This commit is contained in:
Simon Christ 2020-01-31 10:06:07 +01:00
parent 96978cfb70
commit bf619eecbd

View File

@ -903,18 +903,19 @@ end
# lens! - magnify a region of a plot # lens! - magnify a region of a plot
@recipe function f(::Type{Val{:lens}}, plt::AbstractPlot) @recipe function f(::Type{Val{:lens}}, plt::AbstractPlot)
# TODO: validate input # TODO: validate input
sp_index, sp_bbox = plotattributes[:inset_subplots] sp_index, inset_bbox = plotattributes[:inset_subplots]
sp = plt.subplots[sp_index] sp = plt.subplots[sp_index]
xl1, xl2 = xlims(plt.subplots[sp_index]) xl1, xl2 = xlims(plt.subplots[sp_index])
bbx1 = xl1 + left(sp_bbox).value * (xl2 - xl1) bbx1 = xl1 + left(inset_bbox).value * (xl2 - xl1)
bbx2 = bbx1 + width(sp_bbox).value * (xl2 - xl1) bbx2 = bbx1 + width(inset_bbox).value * (xl2 - xl1)
yl1, yl2 = ylims(plt.subplots[sp_index]) yl1, yl2 = ylims(plt.subplots[sp_index])
bby1 = yl1 + bottom(sp_bbox).value * (yl2 - yl1) bby1 = yl1 + bottom(inset_bbox).value * (yl2 - yl1)
bby2 = bby1 + height(sp_bbox).value * (yl2 - yl1) bby2 = bby1 + height(inset_bbox).value * (yl2 - yl1)
bbx = bbx1 + width(sp_bbox).value * (xl2 - xl1) / 2 bbx = bbx1 + width(inset_bbox).value * (xl2 - xl1) / 2
lens_index = last(plt.subplots)[:subplot_index] + 1 lens_index = last(plt.subplots)[:subplot_index] + 1
@show plotattributes[:plot_object].subplots @show plotattributes[:plot_object].subplots
@show plt.subplots[1].plotarea @show inset_bbox
@show sp[:left_margin]
x1, x2 = plotattributes[:x] x1, x2 = plotattributes[:x]
y1, y2 = plotattributes[:y] y1, y2 = plotattributes[:y]
# add subplot # add subplot