Pandas – Plotting

To plot in Pandas, we need to use the plot() method and the Matplotlib library. The pyplot module from Matplotlib is also used for plotting in Pandas. The pyplot.show() is used to display the figure.

Let us see an example:

Output

Pandas Plotting

Let us now see how to plot:

  • Histogram
  • Pie Chart
  • Scatter Plot
  • Area Plot

Histogram

We will create a Histogram here. Set the kind argument of the plot() method to hist. For this, we only need a single column. Let us see an example:

Output

Pandas Histogram

Pie Chart

We will create a Pie Chart here. Use the plot.pie() method to draw a Pie Chart. Let us see an example:

Output

Pandas Pie Chart

Scatter Plot

We will create a Scatter Plot here. Set the kind argument of the plot() method to scatter. For this, we will also set the x-axis and y-axis. Let us see an example:

Output

Pandas Scatter Plot

 

Area Plot

We will create an Area Plot here. Use the plot.area() method to draw an Area Plot. Let us see an example. Let us see an example:

Output

Pandas Area Plot

If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

Working with Categories in Pandas
Pandas Introduction
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment