Skip to content

Instantly share code, notes, and snippets.

@NoFishLikeIan
Created July 26, 2021 17:19
Show Gist options
  • Save NoFishLikeIan/041a953a7fd2b7ce2ffe62ad84717cdf to your computer and use it in GitHub Desktop.
Save NoFishLikeIan/041a953a7fd2b7ce2ffe62ad84717cdf to your computer and use it in GitHub Desktop.
Put box around annotate in Plots.jl
function annotatewithbox!(
fig::Plots.Plot,
text::Plots.PlotText,
x::Real, y::Real, Δx::Real, Δy::Real = Δx;
kwargs...)
box = Plots.Shape(:rect)
Plots.scale!(box, Δx, Δy)
Plots.translate!(box, x, y)
Plots.plot!(fig, box, c = :white, linestroke = :black, label = false; kwargs...)
Plots.annotate!(fig, x, y, text)
fig
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment