Matplotlib Crash Course

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

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

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

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

  • @d.youtubr
    @d.youtubr 3 месяца назад +11

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

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

    *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 4 года назад +1

      Super helpful !! Thank you for this :)

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

      @@awesomekalyana15 You are welcome!

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

    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 года назад +15

    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.

  • @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.

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

    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.

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

    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!

  • @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 !

  • @Xoriant1818
    @Xoriant1818 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

  • @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 Год назад +2

    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.

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

    Very quick, clear and concise highly recommended

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

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

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

    Great introductory course to Matplotlib.

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

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

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

    exactly what I was about to start. Thank you.

  • @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.

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

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

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

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

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

    40:00 why this code worked is hilarious

  • @Aman-yu4re
    @Aman-yu4re 6 месяцев назад +1

    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)

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

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

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

      yeah bro even i got error for that🤣

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

    A very beautiful representation of Matplotlib

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

    More MatPlotLib courses!

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

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

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

    8:20 What was that bro?

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

    Galli is such a dope dude. thanks.

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

    Thanks a lot Keith, very crisp explanation!

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

    Yoooooo..... waiting for such a course

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

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

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

    Great tutorial

  • @salambostaji9315
    @salambostaji9315 2 месяца назад

    This was very useful, thank you!

  • @blackwhite1257
    @blackwhite1257 6 месяцев назад +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 3 года назад +1

    Thank you so much for your great tutorials.

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

    i really like your course keep it up sir

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

    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.

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

    Thank you Keith :)

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

    Nice one and keep it up!

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

    Very well explained! Thank you very much! 💛

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

    excellent as always.

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

    Great video - nice one. Thanks.

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

    brilliant tutorial

  • @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.

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

    thank you so much man .much appreciated

  • @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

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

    I was floored by that yel joke. Hahaha

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

    Awesome!!! TQVM!!

  • @david-eler
    @david-eler Год назад

    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'"

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

    Thanks Keith

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

    thanks man, very throroughly !

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

    I learnt pandas with this guy #respect

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

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

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

    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

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

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

  • @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

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

    thanks for this beautiful video love from india

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

    i wish Coursera courses were this short and brief.

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

    Love your videos they help me a lot.

  • @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.

  • @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

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

    this is gold !

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

    How to comment three lines together? Check 30:16

  • @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?

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

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

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

      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.

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

    Amazing Thanks a lot

  • @max-burd
    @max-burd 3 года назад

    Thanks a lot!

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

    this guy very good

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

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

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

    good stuff

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

    How about a 4D plot with matplotlib?

  • @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! :)

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

    My G!!!
    Thanks pal

  • @silversoul2785
    @silversoul2785 11 дней назад

    legend() did not make labels when putting it in 40:00 , this is probably google colab thing, if using pycharm like me , then must do it manually b adding label to each just like in 40:30
    for legends in loop=>
    for country in gas:
    if country != 'Year': # to avoid year showing up too.
    plt.plot(gas.Year, gas[country], marker='.', label= country )

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

    26:30, let one rip eh?

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

    great vid

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

    Nice!

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

    Thanks a lot

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

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

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

    So Good

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

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

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

    Thanks🤩

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

    Thank you

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

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

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

    Nice

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

    Please make a video on matplotlib animations...

  • @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

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

    33:05 more more

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

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

  • @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.

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

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

  • @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

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

    Phyton trorial about data sciences on data backup

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

    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 9 месяцев назад

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

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

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

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

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

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

    Can anyone share the official documentation link here

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

    6:43

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

    31:38