How can I annotate outside of a plot.
Here is an example:
using Plots, LaTeXStrings
gr()
x = LinRange(0.0,2π, 100)
y= sin.(x)
plt = plot(x, y,
label=["aPlot"],
legend= :outertopright,
legend_column=1
)
scatter!(plt, x[1:3:100], y[1:3:100], markersize = 1, legend_column=2)
str = L"\begin{bmatrix}
1& 2\\
3& 4\\
\end{bmatrix}"
annotate!(10, 1, str)
How can I set the str to be below the legend outside of the plotting area?
I don't know if I entirely follow the question- rendering outside the plot is possible with the code you already have. The issue is with the LaTeX renderer in Plots.jl. Replacing
with
str = L"y = \sin(x)", gives us this:strusing the x and y parameters of theannotate!call.Reading the documentation for LaTeXStrings.jl, it states:
Running equivalent code using GLMakie, I get an error that \begin isn't supported. I can't find the renderer used by Plots.jl in their source code, but it seems clear that whichever one they use, it doesn't support the LaTeX that you're trying within
str.