Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

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]( to find new functions and methods to use to accomplish your goal.

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 45m
Clock icon Aug 21, 2020

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

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans