Dear all

I have downloaded matplot lib for python2.7.2 windows using[(http://matplotlib.org/downloads.html)]Click Here . As per example i tried coding i found pyplot is not highlighted.i have attached test.cv file for which graph has to be plotted

   import csv
        import matplotlib.pyplot as plt
        plt.figure()

        def main():
            pass


        if __name__ == '__main__':
            main()
            file =open("test.csv","r+")
            TIME=[]
            ACT_ANGLE=[]
            DES_ANGLE=[]
            for line in reader:
               TIME.append(line[1])
               print TIME
               ACT_ANGLE.append(line[2])
               DES_ANGLE.append(line[3])

            x=TIME
            z=ACT_ANGLE
            #print x
            y=DES_ANGLE


            plt.plot(x,y)
            plt.xlabel('Time in Sec')
            plt.show()
            plt.savefig("example.png")

error report given below

Traceback (most recent call last):
  File "C:\Documents and Settings\Administrator\My Documents\python code\m2.py", line 2, in <module>

  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 125, in <module>
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

i tried but it didn't worked. Let me know why it doesnot highlight pyplot eventhrough matplot is installed. even i given path from tools

I tried to reproduce the bug in windows XP with python 32 bits installed. I had to install python-dateutil module from Christoph Gohlke's site, then pyparsing as I said in the previous post, but the installer refused to run because I didn't have msvcr71.dll. I got the dll here (download the zip file uncompress and move the dll to the System folder). Once pyparsing was installed, I needed numpy (1.8.0 superpack from sourceforge) and finally the package Six from Gohlke's site. Then the following line succeeded

from matplotlib import pyplot as plt

My advice: install linux mint in a virtualbox and say good bye to issues in python modules installs !

let me know why i cant access to pyplot even if function defined

If it's still the same error message, it means that your python cannot find the pyparsing module and you must find out why. Try

>>> import pyparsing

in your interpreter. Also try to locate pyparsing.py on your computer.

in my interpreter also it is not detecting ,,, giving error as below.best way to plot graph using python

import matplotlib.pypasring as plt
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 125, in <module>
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

Did you install pyparsing ?

yes i installed it . i am sharing some snap shot you can check.

Else let me know links where i can instal newley and make it work.

Where is pyparsing.py on your computer ?
What does python say when you type import pyparsing ?

error report

>Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 125, in <module>
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

I didn't say import matplotlib but import pyparsing

import pyparsing

it will not give any error

 from matplotlib import pyparsing
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 129, in <module>
    "matplotlib requires pyparsing >= 1.5.6")
ImportError: matplotlib requires pyparsing >= 1.5.6

There is a developpers discussion here. You may have an old install of matplotlib still on your disk. You may need to remove the folder C:\Python27\lib\site-packages\matplotlib if it exists, as suggested in this thread, and perhaps reinstall matplotlib.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.