In matplotlib, how can I adjust the alignment of the legend title? It is always centered, but I need it to be left aligned with the legend box. I tried to change the al
I think you need to displace the Text
object, using the set_position((x, y))
method. The units of x
and y
are pixels, so you'll have to experiment with what values look right, or use a Transform
. I'm not sure off hand which combination of Transforms
might be most useful.
So in short, something like this might work:
l.get_title().set_position((-10, 0)) # -10 is a guess