Intro to Data Visualization in Python with Matplotlib! (line graph, bar chart, title, labels, size) @KeithGalli
Intro to Data Visualization in Python with Matplotlib! (line graph, bar chart, title, labels, size)  @KeithGalli
Uploaded June 2019 | Updated November 2026, 3 hours ago
Practice your Python Pandas data science skills with problems on StrataScratch! stratascratch.com/?via=keith

Join the Python Army to get access to perks!
YouTube - youtube.com/channel/UCq6XkhO5SZ66N04IcPbqNcw/join
Patreon - patreon.com/keithgalli

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):
github.com/KeithGalli/matplotlib_tutorial

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

Font List:
jonathansoma.com/lede/data-studio/matplotlib/list-all-fonts-available-in-matplotlib-plus-samples

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: 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.

---------------------------------------------

Follow me on social media!
Instagram | instagram.com/keithgalli
Twitter | twitter.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)
11:20 - Add a legend
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
31:25 - Final Comments

---------------------
If you are curious to learn how I make my tutorials, check out this video: 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.
Intro to Data Visualization in Python with Matplotlib! (line graph, bar chart, title, labels, size)Advanced Web Scraping Tutorial! (w/ Python Beautiful Soup Library)Solving real world data science tasks with Python Beautiful Soup! (movie dataset creation)Full Data Science Mock Interview! (featuring Kylie Ying)Complete Python NumPy Tutorial (Creating Arrays, Indexing, Math, Statistics, Reshaping)3 Insider Tips to Stay Ahead in Programming!Comprehensive Python Beautiful Soup Web Scraping Tutorial! (find/find_all, css select, scrape table)Winning at Connect 4 for an Hour Straight!Creating Analytics Dashboards, Websites, Slideshows and more with Python! | Quarto Crash CourseHow to Make a High Quality Tutorial Video! (workflow, camera equipment, and software tools)Complete Natural Language Processing (NLP) Tutorial in Python! (with examples)Real-World Python Machine Learning Tutorial w/ Scikit Learn (sklearn basics, NLP, classifiers, etc)
Keith Galli |

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

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER