Create a Simple Line Chart
Swipe to start coding
Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:
- Import the
matplotlib.pyplot
under theplt
alias. - Save the
United States
data in theusa
variable. - Create
Figure
andAxes
objects using the.subplots()
method ofplt
and assign them to variablesfig
, andax
, respectively. - 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).
- display years on the x-axis (use the
- Display the plot.
Once you've completed this task, click the button below the code to check your solution.
Løsning
Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.
Tak for dine kommentarer!
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 2.94Awesome!
Completion rate improved to 2.94
Create a Simple Line Chart
Swipe to start coding
Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:
- Import the
matplotlib.pyplot
under theplt
alias. - Save the
United States
data in theusa
variable. - Create
Figure
andAxes
objects using the.subplots()
method ofplt
and assign them to variablesfig
, andax
, respectively. - 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).
- display years on the x-axis (use the
- Display the plot.
Once you've completed this task, click the button below the code to check your solution.
Løsning
Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.
Tak for dine kommentarer!
single
Awesome!
Completion rate improved to 2.94
Create a Simple Line Chart
Stryg for at vise menuen
Swipe to start coding
Build a line chart representing the level of CO2 emissions (metric tonnes of CO2 per person) for the US. Follow the next steps:
- Import the
matplotlib.pyplot
under theplt
alias. - Save the
United States
data in theusa
variable. - Create
Figure
andAxes
objects using the.subplots()
method ofplt
and assign them to variablesfig
, andax
, respectively. - 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).
- display years on the x-axis (use the
- Display the plot.
Once you've completed this task, click the button below the code to check your solution.
Løsning
Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.
Tak for dine kommentarer!