0% found this document useful (0 votes)
3 views2 pages

Matplotlib Plotting Code for Beginners

The document provides a beginner's explanation of Matplotlib plotting code, specifically for creating a scatter plot in Jupyter Notebook. It details the purpose of each line of code, including setting up inline plotting, labeling axes, and plotting data points. An example table illustrates how data points are represented in the scatter plot.

Uploaded by

sosinaanteneh844
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Matplotlib Plotting Code for Beginners

The document provides a beginner's explanation of Matplotlib plotting code, specifically for creating a scatter plot in Jupyter Notebook. It details the purpose of each line of code, including setting up inline plotting, labeling axes, and plotting data points. An example table illustrates how data points are represented in the scatter plot.

Uploaded by

sosinaanteneh844
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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 |

You might also like