Matplotlib Crash Course

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 167

  • @Ricocase
    @Ricocase 4 года назад +199

    "Let's just jump into it" = immediate upvote

  • @leixun
    @leixun 4 года назад +311

    *My takeaways:*
    *1. Line chart* 2:11
    1.1 Potting a line chart using *plot* and *show* 3:27
    1.2 Adding a title using *title* 5:21
    1.3 Adding labels to x and y axes using *xlabel* and *ylabel* 6:24
    1.4 Changing the font of title and labels. Resizing title and labels using *fontdict* 7:02
    1.4 Editing tick marks using *xticks* and *yticks* 8:50
    1.5 Adding a legend using *legend* 11:04
    1.6 Changing line style by passing parameters to *plot* 12:14
    1.7 Adding a 2nd line 17:33
    1.8 Resizing a chart using *figure(figsize(), dpi=)* 21:55
    1.9 Saving a chart using *savefig* 24:34
    *2. Bar chart* 26:48
    2.1 Potting a bar chart using *bar* and *show* 27:40. The size of a bar chart can be changed using *figure(figsize(), dpi=)* as well
    2.2 Setting bar patterns using *set_hatch* 28:50
    *3. Real world Matplotlib examples* 31:10
    3.1 Example 1 - line chart 34:36. Input .csv data file using *pandas pd.read_csv()*
    3.2 Example 2 - histogram 52:35. Potting a histogram using *hist* and *show* . Setting bins.
    3.3 Example 3 - pie chart 1:00:08. Potting a pie chart using *pie* and *show* . Looking for a condition in the data using *pandas loc* . Adding labels for pie chart using a list. Changing colour. Show percentage using *autopct*
    3.4 Example 4 - another pie chart 1:07:20. Converting string data to integer data using *strip* . Changing the pie chart style using *style.use* . Using *pctdistance* to define the positions of percentage. Using *explode* to split the pie chart.
    3.5 Example 5 - box plot 1:18:33. Potting a box plot using *boxplot* and *show* . Using *set* to set colour and linewidth

    • @Amy_Yu2023
      @Amy_Yu2023 4 года назад +2

      Lei Xun Thanks for sharing

    • @aarushgoyal
      @aarushgoyal 4 года назад +1

      Thanks

    • @leixun
      @leixun 4 года назад +1

      @@aarushgoyal You are welcome

    • @awesomekalyana15
      @awesomekalyana15 3 года назад +1

      Super helpful !! Thank you for this :)

    • @leixun
      @leixun 3 года назад +1

      @@awesomekalyana15 You are welcome!

  • @d.youtubr
    @d.youtubr Месяц назад +5

    The best thing about this tutorial is that he keeps the mistakes made.

  • @MrVovik007
    @MrVovik007 4 года назад +72

    Much better than lots of those paid courses out there! Lean, clean and straightforward! Thanks a lot and please please record more videos on other data Science and python related topics in the same manner you did this course!

  • @softyo
    @softyo 2 года назад +13

    i cant believe this is free of charge......thank you so much!!!!!!!!!!!!!!!!! i have also watched your numpy and pandas tutorials and enjoyed them very much!!! thank you for doing this, you are making such a difference.

  • @saurabhsamdani
    @saurabhsamdani 2 года назад +15

    I think keeping documentation window open was such a great advice. My struggles with matplotlib have gone down once I Put that tip in practice.

  • @rishabhmediratta6200
    @rishabhmediratta6200 3 года назад +10

    plt.figure(figsize = (12,7))
    for c in gas.columns[1:]:
    plt.plot(gas['Year'] , gas[c] , label=c , marker='.')

    plt.legend()
    plt.show()
    This worked for me while plotting the line graph for all countries!
    (Note : Include the import statements and read the csv first, haven't included that here.)
    Thank you for the tutorial! This channel is basically where I have started picking up things.

  • @nikitaizmaylov4888
    @nikitaizmaylov4888 3 года назад +7

    I can easily tell that Keith is very keen on FUT and probably has like the best Ultimate team in FIFA 21 ahahahha. Really enjoyed your course, very coherent and simple. Thank you!

  • @YashPatil-iq1yw
    @YashPatil-iq1yw 2 года назад +4

    I usually dont comment but today your course has made me comment, Really it was a very good course learned a lot. KEEP IT UP DON'T STOP!!!!!!!!!!!!!!!!!!!!!!!!!!

    • @Structural_analysis
      @Structural_analysis Год назад

      Python contour animation
      ruclips.net/video/ZFQwwxyKG_U/видео.html

  • @pi_r_mlm
    @pi_r_mlm 4 года назад +20

    Wow ! It's a superb course ! I learnt tons of things ! Also, at 59:00, you can use log=True option to make y log scale
    You're doing great ! Carry on !

  • @dhanushkamadhusanka683
    @dhanushkamadhusanka683 2 года назад +1

    Thank you, Highly appreciate... most important thing is, this is free for every one.. this course much better than paid courses...

  • @shashankgsharma
    @shashankgsharma Год назад +1

    Okay, it took me a lot of time to complete numpy, pandas and matplotlib from you keith, but I think it was worth it. Although, I remember NULL.

  • @yudhisthirsingh8401
    @yudhisthirsingh8401 4 года назад +7

    Great teacher you are man. I have watched all your data visualization videos they all are amazing...

  • @jameshuang582
    @jameshuang582 2 года назад +1

    Very quick, clear and concise highly recommended

  • @masadamsahid
    @masadamsahid 3 года назад +25

    8:22 🤪
    Anyways, thanks for making the tutorial. It's a very helpful tutorial for us 😁

  • @RabiulIslam-tw6qc
    @RabiulIslam-tw6qc 2 года назад +1

    Thank you very much for your wonderful teaching and real-world example. Nice course for learning.

  • @saketkumar1123
    @saketkumar1123 4 месяца назад +3

    40:00 why this code worked is hilarious

  • @AdoiyAngV
    @AdoiyAngV Год назад

    at min 4:34 you can just write plt.plot(x,y); instead of plt.show() ; is enough, thanks for tutorial

  • @anmolmaitra78
    @anmolmaitra78 3 года назад +7

    Thank you so much for your great tutorials. Can you do a tutorial on tableau please?

  • @salambostaji9315
    @salambostaji9315 7 дней назад

    This was very useful, thank you!

  • @ClassDu-lt6xy
    @ClassDu-lt6xy 2 месяца назад

    A very beautiful representation of Matplotlib

  • @markkennedy9767
    @markkennedy9767 11 месяцев назад

    You did a really good job on this. I like how you motivate what you're showing. Great stuff.

  • @CodyBanks10
    @CodyBanks10 3 года назад +1

    Great introductory course to Matplotlib.

  • @codewithnotes8832
    @codewithnotes8832 3 года назад +2

    thanks for amazing explanation. sir please make a video on Scipy.

  • @RahulSingh-il6sz
    @RahulSingh-il6sz 4 года назад +2

    exactly what I was about to start. Thank you.

  • @Aman-yu4re
    @Aman-yu4re 4 месяца назад

    For the people who are following this in 2024, and not getting the country names automatically after using for loop
    just add label=country in plot arguments like this:
    for country in gas:
    if country != 'Year':
    plt.plot(gas.Year, gas[country], label=country)

  • @AmitYadav-mk8dl
    @AmitYadav-mk8dl 5 месяцев назад

    Galli is such a dope dude. thanks.

  • @micha9926
    @micha9926 4 года назад +1

    More MatPlotLib courses!

  • @adithyavikramrajgaroju9218
    @adithyavikramrajgaroju9218 2 года назад

    Thanks a lot Keith, very crisp explanation!

  • @pawansapkota3970
    @pawansapkota3970 3 года назад

    4:11 alternatively you can also use plt.plot(); # use ; to not make to show that matplotlib object creation at certain memory location.

  • @catbook628
    @catbook628 Месяц назад

    brilliant tutorial

  • @devgupta2040
    @devgupta2040 2 года назад +2

    40:15 'How it worked' 🤣🤣. Sometimes we coders don't know what actually happened but that finally works

    • @suraj.panddey
      @suraj.panddey 9 месяцев назад

      yeah bro even i got error for that🤣

  • @rayyanamir8560
    @rayyanamir8560 3 года назад

    i wish Coursera courses were this short and brief.

  • @blackwhite1257
    @blackwhite1257 4 месяца назад +1

    Could you go through the iplot function from matplotlib, too (it’s basically a plotting function that makes interactive plots) and go through candle stick plots? (iplot plots 3d as well as 2d, so please go over iplot 3d as well iplot 2d if you can)

  • @upgraduate
    @upgraduate 2 года назад +1

    Thank you so much for your great tutorials.

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 Год назад

    Very well explained! Thank you very much! 💛

  • @Dan-dg2pc
    @Dan-dg2pc 3 года назад +8

    8:20 What was that bro?

  • @ajefersonstiv
    @ajefersonstiv 4 года назад +4

    😍😍😍 will you make a video for pandas and numpy too? 👀

    • @freecodecamp
      @freecodecamp  4 года назад +2

      Try this one: ruclips.net/video/r-uOLxNrNk8/видео.html

  • @saikoushik4064
    @saikoushik4064 Год назад

    Thank you Keith :)

  • @easternteasers1127
    @easternteasers1127 4 года назад +2

    Great tutorial

  • @JesusJuradoMolina
    @JesusJuradoMolina Год назад

    Hi! I've been trying to follow your steps but I got an error, I wonder if it is due to the Phyton or matplotlib version:
    countries_to_analyze=['Mexico','USA','Canada','Japan']
    for country in gas:
    if country in countries_to_analyze:
    plt.plot(gas.Year,gas[country], marker='.',label=country)
    plt.xticks(gas.Year[::3])
    plt.legend()
    plt.show()
    TypeError Traceback (most recent call last)
    Cell In[131], line 6
    3 if country in countries_to_analyze:
    4 plt.plot(gas.Year,gas[country], marker='.',label=country)
    ----> 6 plt.xticks(gas.Year[::3])
    7 plt.legend()
    8 plt.show()
    TypeError: 'list' object is not callable
    Any help would be so appreciated, take care, Jesus

  • @pythonbrothersandfamily
    @pythonbrothersandfamily Год назад

    I learnt pandas with this guy #respect

  • @mehdismaeili3743
    @mehdismaeili3743 Год назад

    excellent as always.

  • @sachinthakkar4131
    @sachinthakkar4131 Год назад

    Great video - nice one. Thanks.

  • @MuhammadHamza-ki3ze
    @MuhammadHamza-ki3ze 3 года назад +1

    i really like your course keep it up sir

  • @mahmudhasankhan7951
    @mahmudhasankhan7951 2 года назад

    Thanks Keith

  • @markkennedy9767
    @markkennedy9767 11 месяцев назад

    At 45:40, with the for loop, why does it automatically iterate over the headings and not the values under those headings. Is it because pandas saves the CSV file as a dictionary-like structure with the headings as keys. And these are automatically iterated over in a for loop?
    At 1:12:00, how do you not get an error when the condition checks if the entry is less than an integer, when not all of the values under the heading weight will have been converted to integers in the previous code (ie the code "else x" doesn't necessarily give an integer in the list comprehension).
    At 1:22:10, why aren't the arguments for the boxplot barcelona[1] and madrid[1] rather than barcelona and madrid. Since barcelona and madrid seem to be 2D arrays and not 1D arrays.

  • @digigoliath
    @digigoliath 3 года назад

    Awesome!!! TQVM!!

  • @bhanutejachittabathini19
    @bhanutejachittabathini19 3 года назад

    thank you so much man .much appreciated

  • @NareshKumar-dw9xp
    @NareshKumar-dw9xp 4 года назад

    Yoooooo..... waiting for such a course

  • @marbertpinque1512
    @marbertpinque1512 9 месяцев назад

    I was floored by that yel joke. Hahaha

  • @oswevega2939
    @oswevega2939 2 года назад

    thanks man, very throroughly !

  • @pa32779
    @pa32779 2 года назад

    quick question, do you need to know numpy and pandas to learn matplotlib?

  • @david-eler
    @david-eler 10 месяцев назад

    1:00:00 How do I use the bar_label function to this histogram? I always the error "AttributeError: 'tuple' object has no attribute 'patches'"

  • @frenchfries6386
    @frenchfries6386 2 года назад

    this is gold !

  • @lakeshkumar1281
    @lakeshkumar1281 2 года назад

    thanks for this beautiful video love from india

  • @mohammedjashim7186
    @mohammedjashim7186 Год назад

    Nice explanation. Can you please tell me what that for loop is doing and how it will identify the country in gas?

    • @markkennedy9767
      @markkennedy9767 11 месяцев назад

      Hi I asked a similar question. I think it's because the for loop iterates over the headings (the countries) of the CSV file (so countries in the code "for countries in" will refer to these headings). It iterates over these headings (and not over the rows of the table) since the headings are the keys of the dictionary-like structure gas. That's my understanding.

  • @hermanmokgope3011
    @hermanmokgope3011 2 года назад

    Nice one and keep it up!

  • @hellothere1328
    @hellothere1328 4 года назад +1

    Hi, sorry to be a pain, but when I try to import Matplotlib, it gives me an error, DLL load failed while importing ft2font
    Can someone pls help me.
    Edit: is there any fix?

    • @ayyubayyyub9415
      @ayyubayyyub9415 3 года назад

      pip install matplotlib or download anaconda that way you don't have install matplotlib.

  • @samyakbharsakle
    @samyakbharsakle 4 месяца назад

    good stuff

  • @Maria-yx4se
    @Maria-yx4se Год назад

    this guy very good

  • @максимбурдасов-к7е
    @максимбурдасов-к7е 3 года назад

    Thanks a lot!

  • @ayushgupta1881
    @ayushgupta1881 10 месяцев назад

    Thanks a lot

  • @jacob_dmn
    @jacob_dmn 3 года назад

    Amazing Thanks a lot

  • @eiplou4116
    @eiplou4116 3 года назад

    Nice!

  • @sieyeryu5983
    @sieyeryu5983 3 года назад

    At 8:30, I did the same thing on my own. My Jupyter notebook says
    findfont: Font family ['Comic Sans MS'] not found. Falling back to DejaVu Sans.
    findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.
    At 39:48, when I didn't write label, legend didn't work.
    I am using the current version of matplotlib, which is 3.4.2. But I don't use Anaconda. Could it make such differences?

    • @pewolo
      @pewolo 2 года назад +1

      You can install the fonts on your system and your notebook will pick them up.
      Ananconda does not actually install fonts, but rather uses the fonts available system-wide.

    • @sieyeryu5983
      @sieyeryu5983 2 года назад

      @@pewolo Thanks! :)

  • @bennguyen1313
    @bennguyen1313 4 года назад

    If you were to read a binary file containing sample points,
    file = open("sample.bin", "rb")
    How could you import the data into an array, for plotting? For example, assuming you prompt the user for filename, the number of bytes per data, and the endiness.. i.e. the first byte is the MSB or LSB... how would you load/plot the array, data value on the y, and sample number on the x?

  • @at7828
    @at7828 4 месяца назад

    Can you kindly post a link to your Pandas crash course video? Thank you.

  • @JohnLyon0611
    @JohnLyon0611 11 месяцев назад

    So Good

  • @marcus.the.younger
    @marcus.the.younger 3 года назад

    Thank you

  • @browens3717
    @browens3717 4 года назад +2

    Love your videos they help me a lot.

  • @andile3982
    @andile3982 6 месяцев назад

    great vid

  • @markbaidoo7325
    @markbaidoo7325 4 года назад +1

    i was waiting for this video ..... anyway can i use Pycharm ?

  • @haval00
    @haval00 4 года назад

    Is matplotlib an engineering programm cause am studying electrical engineering though ......?????

  • @bryandwayne3200
    @bryandwayne3200 4 года назад

    I have a question please ... Do I need to learn numpy or pandas before I can start freelancing with matplotlib ?

    • @antikad3701
      @antikad3701 4 года назад +2

      Yes, They are inter-related

  • @jumpropemonk7703
    @jumpropemonk7703 4 года назад

    My G!!!
    Thanks pal

  • @ShivaniKumari-cj8nw
    @ShivaniKumari-cj8nw 4 года назад

    Thanks🤩

  • @jumpropemonk7703
    @jumpropemonk7703 4 года назад +1

    I thought the bar trick with around 30:00 is really cool. The One for the for loop. However, I `m not sure what the "pop" functionality is . Does anyone knows?

    • @rssaiganesh
      @rssaiganesh 4 года назад +2

      pop(0) chooses the first element in the list and removes it from the list. So the next first element after '/' is removed will be 'o'. If this explanation is unclear, do let me know.

  • @KokousergeoATSU
    @KokousergeoATSU 7 месяцев назад

    I want to read the fifa_data.csv with pd. read....... But it shows me errors like '' no such file or directory: 'fifa_data.csv'. I downloaded pandas.
    I don't know what to do. Please somebody could help me?

    • @KokousergeoATSU
      @KokousergeoATSU 7 месяцев назад

      I've found a tutorial on RUclips for the problem.

  • @anshrohilla53
    @anshrohilla53 8 месяцев назад

    In the first example 46:45 i am not able to get the legend when for loop is run. Can someone please help me with that

  • @nomannawaz6385
    @nomannawaz6385 Год назад

    please share your panadas video link also ,i am not able to find it

  • @matfoss1
    @matfoss1 3 года назад

    46:30
    for country in gas:
    if country != 'Year':
    plt.plot(gas.Year, gas[country], marker ='.')
    how did you manage to put labels for each country?
    Ps. throws error that says 'No handles with labels found to put in legend.'

    • @nikhiljagtap1669
      @nikhiljagtap1669 3 года назад +3

      plt.plot(gas.Year, gas[country], label=country, marker=".")
      then outside the loop: plt.legend()

    • @niveditapatil4246
      @niveditapatil4246 2 года назад

      @@nikhiljagtap1669 thank you

  • @LLL124Original
    @LLL124Original 4 года назад

    Nice

  • @tzviblonder8494
    @tzviblonder8494 3 года назад +1

    Could you have iterated through the countries using gas.columns[1:] ?

  • @andikachsyfurdjasimilyaspa5066
    @andikachsyfurdjasimilyaspa5066 4 года назад

    Peace to all, at the moment I am making a web-based item lending form, which I want to ask how is it so that when inputing time is not conflicting, for example: If person A enters the form "will" borrow goods from 02:00 - 03:00 , then person B cannot input the loan form with the same item between the hours of 2:00 to 3:00. how to avoid conflicts in the database.

  • @smoothbeak
    @smoothbeak 4 года назад +5

    26:30, let one rip eh?

  • @Idontlikeitstilliamwatching
    @Idontlikeitstilliamwatching 4 года назад

    Please make a video on matplotlib animations...

  • @victormensah6448
    @victormensah6448 4 года назад +1

    How about a 4D plot with matplotlib?

  • @aman_0077
    @aman_0077 2 года назад

    40:29 matplotlib showed no handles with labels found to put in legend? can anyone tell me why it is not working

    • @devchaudhari1341
      @devchaudhari1341 Год назад

      just put label='country_name' argument in every plot function then use legend function

  • @lbars
    @lbars 3 года назад

    How to comment three lines together? Check 30:16

  • @ahmedsobhygharib5978
    @ahmedsobhygharib5978 3 месяца назад

    can someone recommend to me a good video for 3D and higher dimensional graphs

  • @astanalavista
    @astanalavista 3 года назад

    How did you add # to many lines at the same time? (newbie here)

  • @vidishakumari9320
    @vidishakumari9320 Год назад

    Can anyone share the official documentation link here

  • @Harikrishna-py6rn
    @Harikrishna-py6rn 4 года назад

    Phyton trorial about data sciences on data backup

  • @soumadip_banerjee
    @soumadip_banerjee 4 года назад +1

    💕💕💕💕💕

  • @Aisaneslamchalandar
    @Aisaneslamchalandar 10 месяцев назад

    33:05 more more

  • @kMuhammadRayanAli
    @kMuhammadRayanAli 3 года назад

    0:09:57 ohhhhh my goshhhh!!!!!! XD

  • @ASIF-rk1sm
    @ASIF-rk1sm 3 года назад

    is this enough

  • @StevenWang82
    @StevenWang82 Год назад

    I just found the tutor is who interview Kylie hahHa😂