Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Create a Simple Line Chart | Basics: Line Charts
Visualization in Python with matplotlib
course content

Contenido del Curso

Visualization in Python with matplotlib

Visualization in Python with matplotlib

1. Basics: Line Charts
2. Bar Charts
3. Scatter Plots

Create a Simple Line Chart

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 3
toggle bottom row

Create a Simple Line Chart

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 3
toggle bottom row

Create a Simple Line Chart

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Tarea

Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:

  1. Import the matplotlib.pyplot under the plt alias.
  2. Save the United States data in the usa variable.
  3. Create Figure and Axes objects using the .subplots() method of plt and assign them to variables fig, and ax, respectively.
  4. Initialize a line chart:
    • display years on the x-axis (use the .index attribute), convert them to integers (int);
    • display level of emissions on the y-axis (use the .values attribute).
  5. Display the plot.

Once you've completed this task, click the button below the code to check your solution.

Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 3
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt