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.pyplotunder thepltalias. - Save the
United Statesdata in theusavariable. - Create
FigureandAxesobjects using the.subplots()method ofpltand assign them to variablesfig, andax, respectively. - Initialize a line chart:
- display years on the x-axis (use the
.indexattribute), convert them to integers (int); - display level of emissions on the y-axis (use the
.valuesattribute).
- 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.
Рішення
Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Сумаризуйте цей розділ
Пояснити код у file
Пояснити, чому file не вирішує завдання
Awesome!
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.pyplotunder thepltalias. - Save the
United Statesdata in theusavariable. - Create
FigureandAxesobjects using the.subplots()method ofpltand assign them to variablesfig, andax, respectively. - Initialize a line chart:
- display years on the x-axis (use the
.indexattribute), convert them to integers (int); - display level of emissions on the y-axis (use the
.valuesattribute).
- 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.
Рішення
Disclaimer: FREE DATA FROM WORLD BANK VIA GAPMINDER.ORG, CC-BY LICENSE.
Дякуємо за ваш відгук!
single