I have a graph whose left upper corner is quite blank. So I decide to put my legend box there.
However, I find the items in legend are very small and the legend box itself is also quite small.
By "small", I mean something like this
How can I make the items (not texts!) in the legend box bigger?
How can i make the box itself bigger?
When you call legend you can use the
prop
argument with a dict containing size.E.g.
See here for more info on legend
To control the padding inside the legend (effectively making the legend box bigger) use the
borderpad
kwarg.For example, here's the default:
If we change inside padding with
borderpad=2
, we'll make the overall legend box larger (the units are multiples of the font size, similar toem
):Alternately, you might want to change the spacing between the items. Use
labelspacing
to control this:In most cases, however, it makes the most sense to adjust both
labelspacing
andborderpad
at the same time:On the other hand, if you have very large markers, you may want to make the length of the line shown in the legend larger. For example, the default might look something like this:
If we change
handlelength
, we'll get longer lines in the legend, which looks a bit more realistic. (I'm also tweakingborderpad
andlabelspacing
here to give more room.)From the docs, here are some of the other options you might want to explore: