Pandas Plotting
Learn all about Pandas Plotting in this comprehensive tutorial.
- •Pandas uses the plot() method to create diagrams.
- •Specify that you want a scatter plot with the kind argument:
- •Use the kind argument to specify that you want a histogram:
Introduction

Plotting
Pandas uses the plot() method to create diagrams.
We can use Pyplot, a submodule of the Matplotlib library to visualize the diagram on the screen.
Read more about Matplotlib in our Matplotlib Tutorial.
The examples in this page uses a CSV file called: 'data.csv'.
Download data.csv or Open data.csv
Scatter Plot
Specify that you want a scatter plot with the kind argument:
kind = 'scatter'
A scatter plot needs an x- and a y-axis.
In the example below we will use "Duration" for the x-axis and "Calories" for the y-axis.
Include the x and y arguments like this:
x = 'Duration', y = 'Calories'
Let's create another scatterplot, where there is a bad relationship between the columns, like "Duration" and "Maxpulse", with the correlation 0.009403:
Histogram
Use the kind argument to specify that you want a histogram:
kind = 'hist'
A histogram needs only one column.
A histogram shows us the frequency of each interval, e.g. how many workouts lasted between 50 and 60 minutes?
In the example below we will use the "Duration" column to create the histogram:
Module quiz
2 questionsWhich of the following is true about Pandas Plotting?
What is the most common pitfall when working with Pandas Plotting?
Answer all questions to submit.