Seaborn FacetGrid | How to make Small Multiples with Python Seaborn | Titles, Hue, Legend

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024

ความคิดเห็น • 71

  • @MichaelMohr-rz3wf
    @MichaelMohr-rz3wf 3 หลายเดือนก่อน

    Spent several frustrating days looking for something like this to plug my knowledge gap. Exactly what I needed...world's greatest tutorial!

    • @KimberlyFessel
      @KimberlyFessel  2 หลายเดือนก่อน

      Right on! Happy you liked it!

  • @md.humayun-bin-akram9479
    @md.humayun-bin-akram9479 3 หลายเดือนก่อน

    Your explanation saves me a lot of time. Thanks a lot.

    • @KimberlyFessel
      @KimberlyFessel  3 หลายเดือนก่อน +1

      Excellent - glad to hear it was helpful!

  • @brianoliver7240
    @brianoliver7240 3 ปีที่แล้ว +2

    Thanks a lot! I now understand FacetGrid! This will be very useful.

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว +1

      Awesome -- glad to hear that! I agree -- the FacetGrid (along with the catplot, relplot, etc.) are super useful. So much cool functionality!

  • @MsEdnira
    @MsEdnira หลายเดือนก่อน

    Hi! Your videos are awesome. Very clear presentation and powerful contents. Thank you!

    • @KimberlyFessel
      @KimberlyFessel  หลายเดือนก่อน

      Hi! Thanks so much! Glad you like them 😁

  • @lade_edal
    @lade_edal 3 ปีที่แล้ว

    Here you are saving lives again. Or more specifically, hours of life with these thorough but succinct videos..
    Totally in love with you and your videos 🙂

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Why, thank you! So happy my videos have been helpful and enjoyable! 😄

  • @avijitdey992
    @avijitdey992 ปีที่แล้ว

    I have never seen an explanation so beautifully put in a video. Damn! Instant subscribe

  • @BrunoAraujo-po2lm
    @BrunoAraujo-po2lm 3 ปีที่แล้ว +3

    Hey thank you so much for your awesome, organised and detailed didatic method! The best I've seen so far on TH-cam!
    I'd like to make a request. Can you please make a regular expressions series? I'd like to learn how to use them better on strings recognition and text manipulation.

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว +1

      Oh fun - thank you for the suggestion! I enjoy regex pattern building too - especially to help out with string cleaning for NLP or for data extraction during web scraping. I will definitely add it to the list. Glad to hear you are enjoying the content so far!

  • @arnabmukherjee3129
    @arnabmukherjee3129 5 หลายเดือนก่อน

    So nicely explained. Thanks a lot.

    • @KimberlyFessel
      @KimberlyFessel  5 หลายเดือนก่อน

      So glad you liked it - thanks!

  • @ralphsueppel2666
    @ralphsueppel2666 3 ปีที่แล้ว

    Your videos are of great value, as they are concise, practical and clear. I full-heartedly recommended them on my Twitter feed for quant investors. Keep up the good work!

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      So glad you are enjoying the videos and thank you very much for the recommendation on Twitter!

  • @Kiki-g3g
    @Kiki-g3g ปีที่แล้ว

    You really are saving my life with your videos! Thank you

  • @FarizDarari
    @FarizDarari 3 ปีที่แล้ว

    Seaborn FacetGrid is just awesome, and so is this tutorial video! Many thanks!

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Right?! Making these recent videos about the relplot, catplot, etc, I am really amazed at all the cool things you can do with the FacetGrid and with so little code! Cheers and thanks for the support 😄

  • @Alexr26
    @Alexr26 3 ปีที่แล้ว

    Thank you! I was struggling with the hue's legend color and couldn't find the solution anywhere. Awesome tutorial btw.

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      So glad this video provided you with a solution - and thanks!

  • @CaribouDataScience
    @CaribouDataScience ปีที่แล้ว

    Thanks that is what I was looking for.

  • @rajeshsaha9533
    @rajeshsaha9533 3 ปีที่แล้ว

    Kudos for lucid explanation!! Thank you from India.

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Awesome - glad you enjoyed it! Cheers!

  • @lekanadenusi462
    @lekanadenusi462 2 ปีที่แล้ว

    Okay, I love Kimberly 😭

  • @brandoncyoung
    @brandoncyoung 9 หลายเดือนก่อน

    This is really cool

  • @donfeto7636
    @donfeto7636 ปีที่แล้ว

    Thanks so much

  • @espua72
    @espua72 2 ปีที่แล้ว

    thank you so much for the teaching. bravo !!

  • @shubhamtalks9718
    @shubhamtalks9718 3 ปีที่แล้ว

    You just saved one life today❤️.

  • @riniantony2325
    @riniantony2325 3 ปีที่แล้ว +1

    Hi Kimberly, thank you for the video :)
    Could you please let me know hoe exactly is the value on the y axis determined when facet grid is used? I have used it a couple of times but never figured how the y axis values are determined.

  • @kevincaro3320
    @kevincaro3320 3 ปีที่แล้ว

    Thank you so much from France :)

  • @FelipeCampelo0
    @FelipeCampelo0 4 หลายเดือนก่อน

    I can’t like twice so here we go
    👏👏👏

  • @mohammedtahernakes
    @mohammedtahernakes 2 ปีที่แล้ว

    Thank you so much.

  • @tahirhanif9669
    @tahirhanif9669 3 ปีที่แล้ว

    I love your videos .... thank you

  • @muhammadfitrie7061
    @muhammadfitrie7061 3 ปีที่แล้ว

    Keep it up!!! you're the best....

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว +1

      Thanks! 😄 Will definitely continue making more videos.

  • @juana22793
    @juana22793 ปีที่แล้ว

    Hi Kimberly! Thank you for this video. I am finding FacetGrids so useful and easy to use. The only exception is that I created 3 count plots in the FacetGrid and now I am trying to sort the bars by frequency. I created a function for this purpose to insert it in map_dataframe(), but is not working. I have tried multiple things and I cannot get my count plots to be sorted descending so they are visually easier to read. Any ideas? Thank you!

  • @davideeckhout4700
    @davideeckhout4700 ปีที่แล้ว

    Hi, I have a question, for the 'col' argument, I have nine values. How can I make it into a grid instead of nine columns in a row? (like a 4x3 grid)

  • @rashidkhan8161
    @rashidkhan8161 10 หลายเดือนก่อน

    why did you add **kws parameter in function add_mean_ line ?
    please explain...

  • @triblues7065
    @triblues7065 3 ปีที่แล้ว

    Thank you.

  • @oscartorres5201
    @oscartorres5201 3 ปีที่แล้ว

    Hey you are great, keep it up!

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Hey, thank you! I appreciate the kudos! 😄

  • @zouhir2010
    @zouhir2010 3 ปีที่แล้ว

    see ya

  • @pouriaforouzesh5349
    @pouriaforouzesh5349 2 ปีที่แล้ว

    👍🏻

  • @sumengsumeng357
    @sumengsumeng357 3 ปีที่แล้ว

    Great video! I spent so many days solving the problems and finally I am here! thank you !
    I made some nice graphs but they have low resolution or low image quality when I save them as pictures, do you have any idea of that?
    thank you again :)

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว +3

      Oh wonderful! Glad to hear this video helped you. There are a few different ways to save figures. Are you using matplotlib's pyplot function? If so, you can either increase your "dots per inch" or "dpi" with plt.savefig("myfigure.png", dpi=200) - the default is 100 so increasing that will increase your resolution. Or if you are okay with switching to an svg file, that could be increased with no problem since it saves the file with vectors instead of raster dots. So that would be plt.savefig("myfigure.svg").

  • @dongmeili891
    @dongmeili891 3 ปีที่แล้ว

    Thanks.

  • @user-mj7vl9wk1o
    @user-mj7vl9wk1o ปีที่แล้ว

    How i can change position of titles please?

  • @elkegonzales4488
    @elkegonzales4488 3 ปีที่แล้ว

    Hi Kymberly, thanks for the video
    Can I change a different marker within each graph in the small multiples in Seaborn?

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว +1

      Yes! You can do this, but it's a little tricky. If you are mapping sns.scatterplot to your FacetGrid, you'll need to include both the style and markers keywords. "style" should be set to the column name of your facets (for example, if I do "col='species'" in my FacetGrid, I'll do "style='species'" in my map_dataframe method). Then "markers" should be a dictionary where the keys are the categories in your column of interest and the values are which marker you'd like to use (for example, "markers={'Adelie': 'd', 'Chinstrap': '^', 'Gentoo': 'o'}" if I'm working with the penguin species). The full code might look like this:
      g = sns.FacetGrid(penguins, col='species')
      g.map_dataframe(sns.scatterplot, x='bill_length_mm', y='bill_depth_mm', style='species', markers={'Adelie': 'd', 'Chinstrap': '^', 'Gentoo': 'o'})
      Hope that helps!

    • @elkegonzales4488
      @elkegonzales4488 3 ปีที่แล้ว

      @@KimberlyFessel Thanks !!

  • @statisthong6946
    @statisthong6946 2 ปีที่แล้ว

    culmen_depth_mm, culmen_length_mm are not exist but there are bill_depth_mm, bill_length_mm

  • @abhishekpanjiyar8266
    @abhishekpanjiyar8266 7 หลายเดือนก่อน

    is facetgrid same as pivot table plotting?

    • @KimberlyFessel
      @KimberlyFessel  7 หลายเดือนก่อน

      Yes, similar idea to the Pivot Chart in Excel. Though the facet grid can be created from the raw data instead of a pivot table.

  • @MadhurDevkota
    @MadhurDevkota 3 ปีที่แล้ว

    Hello @Kimberly ...thank for such an awesome video. I have been watching your other videos, they are very helpful. When followed your code exactly, I got an error:
    TypeError: add_mean_ln() missing 1 required positional argument: 'data_df'
    and got a plot without any horizontal mean line. My code is:
    def add_mean_ln( data_df, colm= None, **kws ):
    # if no x_var provided skip this altogether
    if not colm: return
    avg = np.mean( data_df[colm] )
    # get current axis
    ax = plt.gca()
    # add v-line at the grp mean
    ax.axvline( avg, color= 'red', ymin=0,ymax=1, lw= 3, ls= '--' )
    # annotate grp mean
    x_pos = 0.65
    if avg > 5000: x_pos = 0.2
    ax.text( x_pos,0.7, s= f'mean = {avg:.0f}',
    transform= ax.transAxes, # (1,1)
    color= 'maroon', fontweight= 'bold', fontsize= 12
    )
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    And this is how I called the facetGrid- using auto_mpg data ( my facetGrid is working well, if I don't use the custom plot function )
    fctGrd1 = sns.FacetGrid( data= auto_df, col= 'cyl_class', row= 'wt_class' )
    fctGrd1.map_dataframe( sns.kdeplot, x= 'mpg' ) #

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Hi there - so glad you found the video useful and that you tried out the code! There's one tiny detail causing this error. The function called "add_mean_ln" needs to take in a positional argument called "data" and NOT "data_df". Strange that it has to be exactly that, but seaborn requires that any function applied via FacetGrid's map_dataframe() MUST have a position argument called exactly "data", which is how it will pass in the data from each facet. Hopefully that clears things up! Cheers!

    • @MadhurDevkota
      @MadhurDevkota 3 ปีที่แล้ว

      @@KimberlyFessel Wow thanks, it works like a charm! This creating custom func for plotting will go a long way for me....
      Thanks for this video and channel. Your explanation are truly cogent, concise and easy-to-understand. Wish I had a teacher like you during my undergrad.
      People like you makes (online) learning possible and pain-free :) Cheers!!

  • @dongmeili891
    @dongmeili891 3 ปีที่แล้ว

    I did type (g) and got “ NameError: name ‘g’ is not defined. But I can direct use g.

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Oh noes! Did you execute the cell above where we assign the result of the FacetGrid to the variable g?

  • @Allinone-ck2lc
    @Allinone-ck2lc 2 ปีที่แล้ว

    What is dat.query

  • @TaxMentors
    @TaxMentors 11 หลายเดือนก่อน

    Why you stop making videos ?

  • @ee203
    @ee203 3 ปีที่แล้ว

    Get some sleep girl. Dark circles but great tutorial

    • @KimberlyFessel
      @KimberlyFessel  3 ปีที่แล้ว

      Haha 😴😴 Appreciate the concern, but alas, my dark circles are a result of allergies and genetics. Glad you liked the tutorial nonetheless.

    • @ee203
      @ee203 3 ปีที่แล้ว +1

      @@KimberlyFessel you are actually gorgeous the way you are.

  • @ujjwaltarway1438
    @ujjwaltarway1438 2 ปีที่แล้ว

    please dont add adds in between the lecture as it disturbs the concentration please