Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Creating Graphs with Matplotlib

Matplotlib is a popular and powerful library for plotting out information using Python. Since Python often works with datasets, and visually representing data can help demonstrate points within data, it makes sense that there is a useful Python library for just that. In this hands-on lab, we'll utilize `matplotlib` to create graphs to display various pieces of information about Target stores opened in the United States. _Warning_: This is a lab designed as part of a professional-level course and is difficult. The lab asks you to accomplish something using methods and functionality of the `matplotlib` library that might not have been covered in lessons. To feel comfortable completing this lab, you'll want to know how to do the following: - Use Matplotlib. Watch the lessons in the "Using Matplotlib" section from this course. - Be comfortable reading the [matplotlib documentation](https://matplotlib.org/) to find new functions and methods to use to accomplish your goal.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 19, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Install matplotlib

    Please Note: Accessing VS Code Server in the browser will require a password. The password is system generated and will either be 24bdf4febea54a8579305316 or can be located on the host itself by logging in via SSH and viewing the config.yaml file.

    cat ~/.config/code-server/config.yaml
    

    Within VS Code Server, you will have the opportunity to use the Jupyter Notebook service to render graphs. It will ask you for a password on first use. There is no password; simply place your cursor in the prompt box and press Enter/Return.

    Before we can use matplotlib to generate graphs, we'll need to make sure that it is installed.

  2. Challenge

    Create a Bar Graph Showing Number of Stores by State

    From within the target_graphs.py file, create a bar chart to display the number of Target stores in each state. It will be useful to use itertools.groupby to collect the information based on the state. It will likely be necessary to change the font size of the axis ticks so that the state abbreviations don't overlap; this can be done with set_yticklabel and set_xticklabel (depending on how the graph is oriented.)

  3. Challenge

    Create a Line Graph Showing New Stores Opened Each Year

    From within the target_graphs.py file, create a line graph that plots the number of Target stores that were opened each year. A line graph works well for charting this because we can visualize the information without adding a new tick label to the axis for years.

  4. Challenge

    Create a Line Graph Showing the Total Number of Target Stores Over Time

    From within the target_graphs.py file, create a line graph that plots the total number of Target stores that are open over time. We'll need to calculate the total for each year by using the total from the previous year and adding the number of new stores opened in a given year.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight