2

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

asked Mar 12, 2012 at 4:51
1
  • 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. Commented Mar 22, 2012 at 22:29

1 Answer 1

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

answered Nov 2, 2020 at 13:25

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.