Matplotlib Legend Tutorial || matplotlib legend outside of graph || Matplotlib Tips

preview_player
Показать описание
This matplotlib legend tutorial walks you through basic and advanced options for matplotlib legends using Python code for a series of matplotlib legend examples. I start from the basics including making a matplotlib legend and the label argument. I show you how to change the matplotlib legend order, and then we thoroughly discuss the matplotlib legend location. I also demo how you can move the matplotlib legend outside of the graph. We move on to making a matplotlib legend horizontal using the ncol keyword argument. Finally, we talk about styling the matplotlib legend including changing the matplotlib legend fontsize, other font properties, the label color, removing the border with frameon, and adding a title to the legend. Last but not least, I show you how to change the matplotlib legend background color with the facecolor argument.

0:00 Introduction
0:24 Legend Basics
1:50 Change Legend Order
2:38 Legend Location
3:41 Legend Outside Plot
5:07 Horizontal Legends
6:13 Legend Font Size, Properties, Color
7:12 Legend Border, Title
7:40 Legend Background Color
7:54 Conclusion

Github Code:

Related Videos:

#matplotlibtips #matplotlib #dataviz
Рекомендации по теме
Комментарии
Автор

Ive come here like 20 times now .😅🤣🤣... By far the most coherrent vidoe on legends I have ever encountered.

Raiden_Amani
Автор

So well explained and in a very simple clear way! Thank you

SomeOne-rxxw
Автор

Amazing job as allways Kimberly! Pls never stop creating videos, it's the best didatic I've found on youtube until now.

BrunoAraujo-polm
Автор

Your videos are golden. Thank you so much !!!

Raiden_Amani
Автор

Well explained and very usefull i think taking you as personnal teacher
quick and efficient

airgeaz
Автор

very nice explaination in every single video

syedmujahid
Автор

Thank you so so much! it is so comprehensive and concise

yem.t.
Автор

Hey Kimberly, nice to meet you! I just found your channel and subscribed, love what you're doing!

I like how clear and detailed your explanations are as well as the depth of knowledge you have surrounding the topic! Since I run a tech education channel as well, I love to see fellow Content Creators sharing, educating, and inspiring a large global audience. I wish you the best of luck on your YouTube Journey, can't wait to see you succeed! Your content really stands out and you've put so much thought into your videos!

Cheers, happy holidays, and keep up the great work!

empowercode
Автор

You are a saviour mam thankyou do keep posting :)

swarnendusekharghosh
Автор

Great that you are doing your videos. Please do more of them. If you could do one or more tutorials for subplot and legends and stylings it would be excellent

orkaneryilmaz
Автор

Thanks. I have a question regarding Seaborn. When I tried violinplot it created the legend automatically, but when I used scatterplot it did not. Hopefully you can do a video on this scenario.

amiracemoney
Автор

Great job. I'm facing the following problem: I have a dataframe and I've encoded the class feature using lable encoding, which I'm using to define the color each data will be plotted through plt.scatter. I've been strugling for hours trying to creat a legend for this graph, without success. Any comments on that?

nirlandossantosbenevenuto
Автор

hi another great video, could you explain how to deal with legend in seaborn, iIcreated a plot and legend in on top of it in the middle and nothing form the seaborn website helped me to move it out

Puma_
Автор

Is there a way to put the legend on the left side (before the y spine)? I tried moving the figure to the right to make room, but still can't get the legend to appear at the left most part of the window!

bennguyen
Автор

When I use 'plt.legend(bbox_to_anchor=(1, 1))' to set the legend outside of the visualization, I'm unable to edit the legend using the fontsize and frameon functions. Is there a way to do this?

Blacklotus
Автор

information on adding two or more legends to same plot would be appreciated

geirha
Автор

how can we make legends for points or scatter plots?

timon
Автор

how to add legends for subplot outside the plot

syedshaulhameed