check bbox type

This commit is contained in:
Simon Christ 2020-03-03 23:11:58 +01:00
parent 4b9cfa4149
commit e816895e50

View File

@ -904,8 +904,10 @@ end
lens!(args...;kwargs...) = plot!(args...; seriestype=:lens, kwargs...) lens!(args...;kwargs...) = plot!(args...; seriestype=:lens, kwargs...)
export lens! export lens!
@recipe function f(::Type{Val{:lens}}, plt::AbstractPlot) @recipe function f(::Type{Val{:lens}}, plt::AbstractPlot)
# TODO: validate input
sp_index, inset_bbox = plotattributes[:inset_subplots] sp_index, inset_bbox = plotattributes[:inset_subplots]
if !(width(inset_bbox) isa Measures.Length{:w,<:Real})
throw(ArgumentError("Inset bounding box needs to in relative coordinates."))
end
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(inset_bbox).value * (xl2 - xl1) bbx1 = xl1 + left(inset_bbox).value * (xl2 - xl1)