improve linking
This commit is contained in:
parent
fc4683c1ea
commit
00f1fed2d1
@ -903,30 +903,38 @@ 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
|
||||||
@show plt.series_list[end][:seriestype]
|
sp_index, sp_bbox = plotattributes[:inset_subplots]
|
||||||
@show plotattributes[:inset_subplots]
|
xl1, xl2 = xlims(plt.subplots[sp_index])
|
||||||
|
bbx1 = xl1 + left(sp_bbox).value * (xl2 - xl1)
|
||||||
|
bbx2 = bbx1 + width(sp_bbox).value * (xl2 - xl1)
|
||||||
|
yl1, yl2 = ylims(plt.subplots[sp_index])
|
||||||
|
bby1 = yl1 + bottom(sp_bbox).value * (yl2 - yl1)
|
||||||
|
bby2 = bby1 + height(sp_bbox).value * (yl2 - yl1)
|
||||||
|
bbx = bbx1 + width(sp_bbox).value * (xl2 - xl1) / 2
|
||||||
@show plotattributes
|
@show plotattributes
|
||||||
x1, x2 = plotattributes[:x]
|
x1, x2 = plotattributes[:x]
|
||||||
y1, y2 = plotattributes[:y]
|
y1, y2 = plotattributes[:y]
|
||||||
# TODO: add subplot
|
# add subplot
|
||||||
for series in plt.series_list
|
for series in plt.series_list
|
||||||
@series begin
|
@series begin
|
||||||
|
inset_index = plotattributes[:series_plotindex]
|
||||||
plotattributes = copy(series.plotattributes)
|
plotattributes = copy(series.plotattributes)
|
||||||
subplot := 2
|
subplot := inset_index
|
||||||
label := ""
|
label := ""
|
||||||
xlims := (x1, x2)
|
xlims := (x1, x2)
|
||||||
ylims := (y1, y2)
|
ylims := (y1, y2)
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# TODO: add lines
|
# add lines
|
||||||
|
# TODO: compute better linking
|
||||||
seriestype := :path
|
seriestype := :path
|
||||||
label := ""
|
label := ""
|
||||||
linecolor := :lightgray
|
linecolor := :lightgray
|
||||||
subplot := 1
|
subplot := 1
|
||||||
@series begin
|
@series begin
|
||||||
plotattributes[:x] = [x2, 4]
|
plotattributes[:x] = [(x1 + x2) / 2, bbx]
|
||||||
plotattributes[:y] = [y2, 10]
|
plotattributes[:y] = [y2, bby1]
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
# add magnification shape
|
# add magnification shape
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user