Beginner Explanation of Matplotlib Plotting Code
1. Code Overview
%matplotlib inline
[Link]('year')
[Link]('per capita income(US$)')
[Link](df['year'], df['per capita income (US$)'], color='red')
2. Line-by-Line Explanation
%matplotlib inline:
Used in Jupyter Notebook to display plots inline (inside the notebook output).
[Link]('year'):
Labels the x-axis to tell viewers it represents years.
[Link]('per capita income(US$)'):
Labels the y-axis to tell viewers it shows per capita income in US dollars.
[Link](df['year'], df['per capita income (US$)'], color='red'):
Creates a scatter plot using the 'year' column for the x-axis and the 'per capita income (US$)' column for the
y-axis. Each dot is colored red.
3. Example Table
| year | per capita income (US$) |
|------|--------------------------|
| 2000 | 3000 |
| 2001 | 3200 |
| 2002 | 3500 |
| 2003 | 3700 |
These data points would plot as red dots at coordinates (2000, 3000), (2001, 3200), etc.
Beginner Explanation of Matplotlib Plotting Code
4. Summary Table
| Line of Code | Purpose |
| -------------------------------------- | ------------------------------------------- |
| %matplotlib inline | Show plots inside Jupyter Notebook |
| [Link]('year') | Label x-axis as "year" |
| [Link]('per capita income(US$)') | Label y-axis as "income in US dollars" |
| [Link](..., color='red') | Draw a red scatter plot from your DataFrame |