-4

How do I plot these using matplotlib or pandas' plot?

I've tried this btw:

topic_count.plot.bar(stacked=True)

Which outputs :

 <matplotlib.axes._subplots.AxesSubplot at 0x118bdfeb8> 

and nothing else, I am not seeing a plot. please help

s.23
  • 41
  • 1
  • 6
  • Maybe you want to read [ask] or [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – ImportanceOfBeingErnest Aug 11 '17 at 14:11
  • No plots are showing. I have tested with: plt.plot(x,y) which should return a simple line graph but I am getting nothing – s.23 Aug 11 '17 at 14:15
  • Have you entered `%matplotlib inline`? – Tony Aug 11 '17 at 14:16
  • So the fact that you want to use groupby is completely irrelevant to the problem?! Why is it in the question then? To make sure plots are shown you need to call `plt.show()` at the end of the script. If this is run in a jupyter notebook (who would know if you're not telling that?) you may also use `%matplotlib inline` at the beginning of the code. – ImportanceOfBeingErnest Aug 11 '17 at 14:18
  • I hva entered it now and it is working! Thank you Tony! – s.23 Aug 11 '17 at 14:18
  • groupby is relevant because I'm asking how to plot not if I can see the plot that was just another bump in the road- which is now fixed. so my questions is how can I plot this data because it is a lot of data and prints are tiny? – s.23 Aug 11 '17 at 14:20
  • Ok. Fine. Then remove everything not relevant to the question and include everything relevant to the question. See my very first comment. – ImportanceOfBeingErnest Aug 11 '17 at 14:21
  • Okay done, changed the question. Now you don't need to down vote it! – s.23 Aug 11 '17 at 14:24
  • also consider checking out the plotly library, its a very good one (not saying it's better than matplotlib, just for you to check that out if you haven't yet) – Gabriel Belini Aug 11 '17 at 14:43

2 Answers2

4

Crude example with matplotlib:

import matplotlib.pyplot as plt
foo = [1, 2]
plt.plot(foo)
plt.show()

And this should show you something like this: Plot result

Some references:

nedward
  • 458
  • 1
  • 4
  • 12
-2

to see the figure

1.you may install IPython(just like Python stand IDE but stronger)

2.launch IPython in terminal like this:ipython --pylab

3.type topic_count.plot.bar(stacked=True) you could see the picture

ideoutrea
  • 198
  • 1
  • 11