Matplotlib Fundamentals
Learn to make effective, customized data visualizations in Python with Matplotlib.
StartMake a Line Chart
Lesson 1 of 2
- 1There are many different tools for making data visualizations in Python, but some of the most common are - Jupyter Notebooks for running code and viewing results - pandas for loading and o…
- 2Welcome to this lesson on matplotlib! As we just learned, matplotlib is a Python library used for making graphs. It’s commonly used by research scientists and data scientists, among other professio…
- 3Before we jump into making a line chart, let’s take a step back and learn about five common chart types in data visualization, and how we make them appear in matplotlib. Each graph that can be mad…
- 4As we saw in the last exercise, each graph in matplotlib is made using the specific graph function for that graph. Inside the parentheses of the function, we put arguments that are specific to …
- 5Okay, we’ve covered some basics on matplotlib syntax and seen how graphs are made and altered. Now let’s make a chart ourselves! In the next few exercises we’ll focus on making a line chart to comp…
- 6We created a basic line chart just by supplying x and y parameters to the .plot() function. Once we have more than one line in the chart, matplotlib will automatically style them with different col…
- 7This graph is starting to get interesting! It’s pretty hard to interpret, though, so let’s add a title and legend. When we set the parameters for our line chart and changed line formatting, we did…
- 8Finally, let’s fix up a couple loose ends on this graph to make it look finished and intentional. Our lines, title, and legend are good to go, but the axes aren’t labeled, and the overlapping tick …
- 9Wow, we covered a lot! Let’s export our finished line chart. To export a chart, we just call the function plt.savefig(), giving the filename we want as an argument. So, to save a line chart as ‘my…
What you'll create
Portfolio projects that showcase your new skills
Make a Line Chart for Research
Make a line chart with matplotlib to visualize precipitation data in six locations around the world.
Make the Other Charts: Silly's Ice Cream Shop Project
Make visualizations (bar chart, pie chart, scatterplot, and histogram) to answer questions about sales data. Enhance the charts with parameters like error bars, AB lines, and subplot configuration.
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory