## Intro to Data Visualization in Python with Matplotlib! (line graph, bar chart, title, labels, size)

Yay finally posting again. Hopefully this video will help you get comfortable working through the matplotlib library. I’m going to post a follow up video with real-world examples (combining pandas with matplotlib) and different types of plots next week. I originally was going to include that in this one, but I thought the video was getting a bit too long.

In this video we walk through some of the basics of matplotlib. We start by making a simple line graph. We learn how to give the graph a title and label the x & y axis. We learn how to scale the graph by specifying the x & y tickmarks. After this, we restyle our line by passing in keyword arguments then do basically the same thing with a shorthand notation. We resize our graph and save it. Then we end with a simple bar chart.

Source Code (includes code and data for next video as well):
https://github.com/KeithGalli/matplotlib_tutorial/

Matplotlib Pyplot Documentation:
https://matplotlib.org/api/_as_gen/matplotlib.pyplot.html

Install libraries Needed for this video:
Option 1:
Open up a terminal window and type
pip install matplotlib
pip install numpy
pip install pandas

Option 2:
Download anaconda which will contain all the packages we need. A video on how to do this is here: https://youtu.be/YJC6ldI3hWk

Thanks for watching! Make sure to like and subscribe to not miss any future videos! Let me know if you have any questions.

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I’ve been using Kite for 6 months and I love it! https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=keithgalli&utm_content=description-only

———————————————

Instagram | https://www.instagram.com/keithgalli/

——————————————–

Video Timeline:
0:00 – Video overview (note real-world examples moved to next video)
1:43 – Setup
2:23 – Our first line graph!
4:50 – Add title and labels for x & y axis
7:13 – Change font type, size, etc.
9:02 – Change tick marks (scale graph)
12:25 – Restyle our line (color, line style, markers, width)
15:53 – Shorthand notation to restyle lines
17:27 – List of line customization options
17:55 – Plot more complex lines
22:20 – Resize Graph
24:48 – Save Graph
26:00 – Annotating/Cleaning Code
27:00 – Bar Chart

———————
If you are curious to learn how I make my tutorials, check out this video: https://youtu.be/LEO4igyXbLs

*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.

Source

### Comment List

• Keith Galli
November 14, 2020

Hi Keith. Thanks for your Videos – they demystify the subject matter. I Had issues registering and importing Matplotlib in Visual Studio Code (free version). Only able to plot with Matplotlib when using Jupyter Notebook. Can you assist in getting Matplotlib running in Visual Studio Code?

• Keith Galli
November 14, 2020

thank u

• Keith Galli
November 14, 2020

"if i did 'yel' which is not a color it's gonna yell at me"
thanks for the tutorial

• Keith Galli
November 14, 2020

thank you for this video. its very very helpful.

• Keith Galli
November 14, 2020

nice job

• Keith Galli
November 14, 2020

anyone did you notice? a weird sound here 26:43 ?

• Keith Galli
November 14, 2020

Thank you so much for making this, Keith

• Keith Galli
November 14, 2020

Thanks a lot, bro.
You are amazing. Thanks for your time, but could you make a tutorial about a real project, please, so that we can use all of the libraries that you taught us?

• Keith Galli
November 14, 2020

Thank you and very helpful Video!

• Keith Galli
November 14, 2020

As we have already declared x and y in the beginning , then why didn't we pass x and y instead of list in xticks and yticks ?

• Keith Galli
November 14, 2020

Wanted to put the values for each Bar. How to do that.. looks like plt.text can help. But it's getting more complicated. solved, thanks

• Keith Galli
November 14, 2020

FLASH|||||||| 26:45

• Keith Galli
November 14, 2020
• Keith Galli
November 14, 2020

yes we need super duper coverage too

• Keith Galli
November 14, 2020

How to resolve the error "<Figure size 360×360 with 0 Axes>"? When i save it, the png file is coming blank.

• Keith Galli
November 14, 2020

I like the way you teach

• Keith Galli
November 14, 2020

Thanks Sir, any guidance on using matplotlib to plot trajectories?

• Keith Galli
November 14, 2020

Any regression model or clustering model from scratch Keith, looking forward to it

• Keith Galli
November 14, 2020

How can we plot Map through Lat & Long ?

• Keith Galli
November 14, 2020

Thanks Keith! Can you make a video showing how to draw a box with 10 rows and 10 columns, total 100 grids, and each grid contains a value from a file. Like a storage box.

• Keith Galli
November 14, 2020

You are super awesome bro love yuh 👌👌👌👍👍

• Keith Galli
November 14, 2020

Hey Keith u are amazing at making virtual lessons with an understandable concept and ur way of teaching is quite good. Hope u will make more vedios on all the programming languages

• Keith Galli
November 14, 2020

I have csv data of one city which is I have been read in python using panda library now I want to extract specific area of that city How would I do this ? Which Library would I use for this purpose ?
Csv City data contains (Lat & Long )

• Keith Galli
November 14, 2020

Thanks man.

• Keith Galli
November 14, 2020

how to comment everything out in Jupyter notebook

• Keith Galli
November 14, 2020

Thank you, I am happy I found these videos on the right time.

• Keith Galli
November 14, 2020

Man, this was right on time!!!!

• Keith Galli
November 14, 2020

• Keith Galli
November 14, 2020

This video is sooooo helpful! Very clear and fun instruction 😀

• Keith Galli
November 14, 2020

sorry i have a question

when i installing the package " plt" .

That is displayed

" ERROR: Could not find a version that satisfies the requirement plt (from versions: none)

ERROR: No matching distribution found for plt
"

I need help :/ pls

• Keith Galli
November 14, 2020

thanks keith for such an amazing video on matplotlib your content is very much structured and well taught the concept in very layman terms so even a non-techie can learn concept great video keep posting more

• Keith Galli
November 14, 2020

fontdick = 30cm