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

Conteúdo do 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

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 3
toggle bottom row

Create a Simple Line Chart

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 3
toggle bottom row

Create a Simple Line Chart

Tarefa

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.

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Tarefa

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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 3
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt