I have a series of subplots each with their own legend. however, the boxes around the legends are too big. how could I make them smaller? like, why is the red line in avg N so long?
Not the most helpful answer but it seems to me like they are all just the standard size that they would be in a regular plot, i.e. they don’t resize with the addition of subplots?
no it does not (like, that decreases the font size alright, but the lines are much too long, and the markers are much too big). this doesn’t work very well for me.
I sympathize with this - I find the legend control in Plots.jl to be quite inadequate. I struggle with the legends every week. If anyone is aware of a Plots.jl legend tutorial showing all options, could you please share a link?
My usual strategy is to set some default and fairly large font sizes, like the following:
And then for the final plot call (to bring together all of the subplots), I usually adjust the size argument until I am happy with the final look, e.g.:
hey, that sounds intriguing. no, i haven’t tried that! thanks for the hint i’ll give it a go.
I’m working on an interactive plot, so I can’t really use pyplot (too slow). but that backend seems to handle the legend box much better.
Legend box scales with legendfontsize, adjusting that adjusts the legend. You could specify the position of the legend manually. Try plot(rand(3), legend=(3,3), legendfontsize=5)
that’s not bad as a start! however, the size of the marker in the legend does not scale with that parameter. my problem is particularly acute with subplots, where I may have multiple lines per subplot. with your approach I can make the box of the legend smaller (which is great), but I get disproportionately big marker dots in the legend. shouldn’t the markersize map onto that legend dot?
Your actual use case could very well do without the balls in the legends.
Colored lines seem to suffice and can be displayed alone in the legends, while keeping the balls in the subplots.