I am using Python 2.7.1+ in my Ubuntu 11.04 natty laptop. I installed nltk and all the dependencies to plot graph:
matplotlib==1.1.0
nltk==2.0b9
numpy==1.5.1
scipy==0.8.0
However, when I try to plot a graph (as follows), nothing is showing up (no error code as well):
user@user-laptop-ubuntu:~$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot(range(10), range(10))
[<matplotlib.lines.Line2D object at 0x2770fd0>]
>>> plt.title("Simple Plot")
<matplotlib.text.Text object at 0x2607610>
>>> plt.show()
>>>
or, this code:
>>> from nltk.book import *
>>> text4.dispersion_plot(["citizens", "democracy"])
Funny thing is, I have the same configuration in my desktop Ubuntu 11.04 and the plot is showing up there. I have similar libraries installed in both the computer.
I am totally puzzled now. Any suggestion will be cordially welcomed :-)
Gias
-
I also have Python 2.7.1+ and Ubuntu 11.04, and the above Python shell code works fine to produce a plot for me.ely– ely2012年03月22日 22:29:16 +00:00Commented Mar 22, 2012 at 22:29
1 Answer 1
import matplot.pyplot as plt
from nltk.book import *
text4.dispersion_plot(["citizens", "democracy"])
plt.show()
I dont understand your question. But this trick works for me to plot nltk dispersion plot. Explain your question in detail.
Thank You