Only plot Legend / Plot Legend seperately #4598
Answered
by
jkrumbiegel
mobergmann
asked this question in
Q&A
-
I am currently trying to save the legend of a plot separately, because many of my plots use the same legend and I only want to include them in my latex document once, and that time without a plot. Is it possible to only plot the legend, and when yes, how? I tried to research it the whole day long, but couldn't find a solution. BTW, this one of my plots: using CairoMakie
...
fig = Figure()
ax = Axis(
fig[1, 1],
xlabel = "Time (minutes)",
ylabel = "Moisture",
aspect = AxisAspect(1)
)
for (i,pad) in enumerate(eachrow(y_pads))
lines!(ax, x, pad, label="Pad $i")
end
# add all time pouring
for i in eachindex(vlines_max)
band!(ax, [vlines_min[i], vlines_max[i]], [0,0], [1100,1100], color=(:gray, 0.5), label="Pouring")
end
fig[1, 2] = Legend(fig, ax, "Legend", merge=true, nbanks=2)
save("$(@__DIR__)/plots/moisture.pdf", fig) |
Beta Was this translation helpful? Give feedback.
Answered by
jkrumbiegel
Nov 19, 2024
Replies: 1 comment 1 reply
-
This should work I think, a legend does not need to be in the same figure as the content it gets its entries populated with:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mobergmann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work I think, a legend does not need to be in the same figure as the content it gets its entries populated with: