Seaborn scatter plot | How to make and style a scatterplot in Python seaborn

  Рет қаралды 22,437

Kimberly Fessel

Kimberly Fessel

Күн бұрын

Пікірлер: 41
@AmanSingh-vo1fh
@AmanSingh-vo1fh 2 жыл бұрын
Thanks a lot mam I have recently begun my DS journey and have referred to many amazing tutorials for numpy, pandas , matplotlib etc. But yours was the best one I have seen so far. Thanks again
@francoquispevidal1702
@francoquispevidal1702 3 жыл бұрын
Thanks youu!!! I spent my time watching many tutorials that helped me very little until I found your KZbin channel. Your videos are definitely the best.
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Wow -- thanks so much! Glad you are enjoying my videos and happy to hear they are helping!
@BrunoAraujo-po2lm
@BrunoAraujo-po2lm 3 жыл бұрын
Totally agree!
@vitorribeirosa
@vitorribeirosa 3 жыл бұрын
Thank you so much for sharing these content. I have watched several of your videos and they have made my life at lab way better.
@luvpurohit7488
@luvpurohit7488 3 жыл бұрын
great set of videos,could you also do one to explain which plots to use when , i know it comes with practice
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Thanks -- I love this idea! I have been thinking about doing a few videos showing my thought process when selecting which figure to use and how I select my styling. It definitely comes with practice and depends on the data story, but maybe it would be helpful to show the thought process for a few examples. 👍
@manavsaxena5579
@manavsaxena5579 3 жыл бұрын
@@KimberlyFessel Yes please! As a beginner, I mostly end up using bar plot, histograms and scatter plots. I would really appreciate if you could make a video on this.
@saharatnulor7453
@saharatnulor7453 8 ай бұрын
This video is very helpful. Tank you
@KimberlyFessel
@KimberlyFessel 8 ай бұрын
Most welcome! Glad it helped!
@katharinabuelow9660
@katharinabuelow9660 3 жыл бұрын
Thank you, that was very helpful!
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Super -- very glad to hear that!
@Himanshu-ed3mf
@Himanshu-ed3mf 3 жыл бұрын
Though 'cut' column contains only two categories: 'Premium' and 'Good' but in legend it is showing all the categories. How it is possible?
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Yes, this is a relatively recent seaborn update. The data that come with seaborn have "category" data types for the strings. This means they have a property called .cat.categories. This gives all the categories (even the ones that aren't present), and this is what seaborn builds the legend from. You can override this either by not having the category data types (converting to strings, say) or by setting hue_order like I did in my recent countplot video here: kzbin.info/www/bejne/boaYmWZ7f9qobq8
@mohammed_Ansar
@mohammed_Ansar 3 жыл бұрын
i love your vedios.. you will make me data analyst soon..
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Yes! All the best on your data analyst journey!
@vedansh4033
@vedansh4033 2 жыл бұрын
on setting hue, cuts with value zero like 'fair', 'ideal' are also getting plotted, how to get rid of them
@peterjuhasz976
@peterjuhasz976 2 жыл бұрын
Hi Kimberly, Thank you very much for the course! I especially like your clear explanations. I would like to add some information. I am using seaborn 0.11.2. In the diamond dataset cut, color and clarity are now type of category. So the filtered out values also appear on legend when hue is used. They also appear when you type diamonds['cut'].value_counts() with count 0. To avoid this I changed the these fields back to string with diamonds['cut'] = diamonds['cut'].astype('str'). Do you have a better solution for this? And please add this information to your notes or to the new version of this video. Thank you again.
@trellacelawrimore1215
@trellacelawrimore1215 2 жыл бұрын
Yes, I had the same problem!
@debatradas9268
@debatradas9268 2 жыл бұрын
thank you so much maam
@isabelahorta3063
@isabelahorta3063 2 жыл бұрын
Hi, Dr. Fessel! Thank you so much for the video! How can I add a trend line on the scatter plot?
@MrJojoxD
@MrJojoxD 2 жыл бұрын
Try using seaborn's lmplot()
@alexisrangelcalvo6781
@alexisrangelcalvo6781 2 жыл бұрын
Thanks a lot!
@evanwright640
@evanwright640 2 жыл бұрын
How do you make a midpoint for the colors?
@arul7467
@arul7467 4 жыл бұрын
thanks!! this helped a lot
@KimberlyFessel
@KimberlyFessel 4 жыл бұрын
Awesome -- glad it helped!
@vaibhavarora9408
@vaibhavarora9408 4 жыл бұрын
Thanks!
@KimberlyFessel
@KimberlyFessel 4 жыл бұрын
Welcome!
@ASmallGreenBean
@ASmallGreenBean 4 жыл бұрын
Hi! Could you explain how you get the legend to show the correct 'custom' markers, if this is even possible? (Referring to 9:10) Thanks a lot for these videos!
@KimberlyFessel
@KimberlyFessel 4 жыл бұрын
Hi there -- the legend in the figure you referenced was autogenerated by Seaborn, so you can match up the hue to the diamond cut and the marker shape to the diamond color. But a couple of things: 1. With the most recent update, Seaborn treats many columns as the "category" data type rather than strings. This means that if you do the filtering like I did in this video (with the old version of Seaborn), you will see many unused categories in the legend. You can either convert these columns to strings (with pandas .astype() method) or drop these unused categories (with pandas cat.remove_unused_categories() method: pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.cat.remove_unused_categories.html#pandas.Series.cat.remove_unused_categories) to make your legend look like mine. 2. Also -- you can create your own custom legend if you'd like to match up the color and marker and, say, use a labels like "Premium, F", "Premium, D", etc. This StackOverflow post walks you through how you could do that: stackoverflow.com/questions/54682473/change-legend-location-and-labels-in-seaborn-scatter-plot
@simplemente_humano
@simplemente_humano 3 жыл бұрын
Excellent tutorial. Learned a lot. :) In minute: 1:32, what does the argument random_state means? And why did you choose = 22?
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Hi there -- random_state just allows for reproducibility. Since I'm selecting a random subset of the data, using random_state sets the seed of my random number generator. That means if you run this code, you will get the same random rows as me. And the number 22 is completely arbitrary! I often choose 42 in honor of "The Hitchhiker's Guide to the Galaxy." :) But you can pick any number you'd like.
@simplemente_humano
@simplemente_humano 3 жыл бұрын
@@KimberlyFessel Thank you😃
@gustavoviana1178
@gustavoviana1178 2 жыл бұрын
hey nice video!
@muhdhazim5857
@muhdhazim5857 3 жыл бұрын
hi, may I know how to change hue that shows the legend into the colorbar?
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Hi there - once you create your color bar you can just add it to the figure and remove the current legend. This reference should be able to help you out: stackoverflow.com/questions/62884183/trying-to-add-a-colorbar-to-a-seaborn-scatterplot
@kannan.s566
@kannan.s566 2 жыл бұрын
Also explain remaining parameters
@nsnilesh604
@nsnilesh604 3 жыл бұрын
How to write text i want to show with scatter plot
@KimberlyFessel
@KimberlyFessel 3 жыл бұрын
Hi there - you can add text to seaborn figures by using matplotlib pyplot's text function. And here is my past video on that: kzbin.info/www/bejne/hHO8q4aXiceimq8 You can even automatically update the text positions so they don't overlap on the scatterplot using a library called AdjustText (Video here: kzbin.info/www/bejne/roS2Zmx9lptnqLM)
@kyleparsotan6799
@kyleparsotan6799 2 жыл бұрын
Tried to annotate the figure: #plt.text(x_pos, y_pos, f"y = {m:.2f}x {b:.1f}", bbox=dict(facecolor='white', alpha=0.5)) #plt.text(5, 5, f'R$^2$ = {R_value:.4f}', bbox=dict(facecolor='red', alpha=0.5)) plt.annotate( # Label and coordinate 'R$^2$ = {R_value:.4f}', xy=(5, 50), xytext=(0, 80), # Custom arrow bbox=dict(facecolor='red', alpha=0.5)) but my y values no matter what way I try isn't going up or down.
@judetochukwuogbozor6355
@judetochukwuogbozor6355 2 жыл бұрын
I love you Kimberly🤩🤩🤩🤩
Каха и лужа  #непосредственнокаха
00:15
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
Matplotlib Tutorial (Part 7): Scatter Plots
21:24
Corey Schafer
Рет қаралды 180 М.
Seaborn histplot | How to make a Seaborn histogram plot with Python code
12:39
Seaborn Tutorial : Seaborn Full Course
59:34
Derek Banas
Рет қаралды 201 М.
Seaborn Is The Easier Matplotlib
22:39
NeuralNine
Рет қаралды 178 М.
SCATTER PLOT IN MATPLOTLIB || MATPLOTLIB || PYTHON PROGRAMMING
9:50
Sundeep Saradhi Kanthety
Рет қаралды 22 М.
Каха и лужа  #непосредственнокаха
00:15