To plot in Pandas, we need to use the plot ( ) method and the Matplotlib library.
Fantastic news! We've Found the answer you've been seeking!
Question:
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:
Example: 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:
Exercise : Write your code to create a histogram with different items and values?
Your Code:
Output:
Example: Pie Chart
We will create a Pie Chart here. Use the plot.pie method to draw a Pie Chart.
Output:
Exercise : Write your code to create a Pie chart with different items and values?
Code:
Output:
Example: 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 xaxis and yaxis. Let us see an example:
Output:
Exercise : Write your code to create a scatterplot with different items and values?
Code:
Output:
Example: 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:
Exercise : Write your code to create a Area plot with different items and values?
Code:
Output:
Related Book For
Accounting for Decision Making and Control
ISBN: 978-0078025747
8th edition
Authors: Jerold Zimmerman
Posted Date: