I am using pandas to plot a graph. The following is my function
count_subset.plot(kind='barh', stacked=True)
The response I get is
<matplotlib.axes.AxesSubplot at 0x111fc4ad0>
I can't see the graph anywhere. Am I missing some library ?
We can plot a dataframe using the plot() method. But we need a dataframe to plot. We can create a dataframe by just passing a dictionary to the DataFrame() method of the pandas library.
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.
To plot a specific column, use the selection method of the subset data tutorial in combination with the plot() method. Hence, the plot() method works on both Series and DataFrame .
You have to 'show' the plot using matplotlib's show
:
import matplotlib.pyplot as plt
... #plotting code
plt.show()
Another way is, if you use IPython, to activate the matplotlib magic to have it interactively (no need to call show then):
%matplotlib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With