Merge e83c6e66b03be627557c2c53aaef628ea5f9b805 into d8da3c60d980ebb341b2fba77fb3994aa64fe82e

This commit is contained in:
Misha Mikhasenko 2022-04-28 22:29:49 -04:00 committed by GitHub
commit 100e49343b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -69,6 +69,7 @@ export
default, default,
with, with,
twinx, twinx,
twiny,
pie, pie,
pie!, pie!,

View File

@ -681,3 +681,16 @@ function twinx(sp::Subplot)
end end
twinx(plt::Plot = current()) = twinx(plt[1]) twinx(plt::Plot = current()) = twinx(plt[1])
function twiny(sp::Subplot)
sp[:top_margin] = max(sp[:top_margin], 20px)
plot!(sp.plt, inset = (sp[:subplot_index], bbox(0,0,1,1)))
twinsp = sp.plt.subplots[end]
twinsp[:xaxis][:mirror] = true
twinsp[:background_color_inside] = Plots.RGBA{Float64}(0,0,0,0)
link_axes!(sp[:yaxis], twinsp[:yaxis])
twinsp
end
twiny(plt::Plot = current()) = twiny(plt[1])