Ask Your Question

How can the title of the legend be aligned in matplotlib?

asked 2022-12-23 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-25 22:00:00 +0000

david gravatar image

The title of a legend in matplotlib can be aligned using the following code:

legend = plt.legend(title="Legend Title", title_align='center')

The title_align parameter can be set to 'center', 'left', or 'right' to adjust the alignment of the legend title. By default, it is set to 'center'.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-12-23 11:00:00 +0000

Seen: 22 times

Last updated: Jun 25 '21