Basic plots with Matplotlib

Intermediate Python

Hugo Bowne-Anderson

Data Scientist at DataCamp

Basic plots with Matplotlib

  • Visualization

bar chart icon

  • Data Structure

code icon

  • Control Structures

  • Case Study

Intermediate Python

Data visualization

  • Very important in Data Analysis

    • Explore data
    • Report insights

Intermediate Python

1 Source: GapMinder, Wealth and Health of Nations
Intermediate Python

1 Source: GapMinder, Wealth and Health of Nations
Intermediate Python

1 Source: GapMinder, Wealth and Health of Nations
Intermediate Python

Matplotlib

import matplotlib.pyplot as plt

year = [1950, 1970, 1990, 2010]
pop = [2.519, 3.692, 5.263, 6.972]
plt.plot(year, pop)
plt.show()

Intermediate Python

Matplotlib

Intermediate Python

Matplotlib

Intermediate Python

Scatter plot

import matplotlib.pyplot as plt
year = [1950, 1970, 1990, 2010]
pop = [2.519, 3.692, 5.263, 6.972]
plt.plot(year, pop)
plt.show()
Intermediate Python

Scatter plot

import matplotlib.pyplot as plt
year = [1950, 1970, 1990, 2010]
pop = [2.519, 3.692, 5.263, 6.972]
plt.scatter(year, pop)
plt.show()

Intermediate Python

Let's practice!

Intermediate Python

Preparing Video For Download...