Hello friends,
I am a newbee to matplotlib and I am trying to plot (scatter plot) some
values. The data is quite big and I have them in a CSV file. For a starter I
thought I will use loadrec.py example to see if I am able to import the data
from the CSV file. The loadrec.py goes like this:
from matplotlib import mlab
from pylab import figure, show
import matplotlib.cbook as cbook
datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
print 'loading', datafile
a = mlab.csv2rec(datafile)
a.sort()
print a.dtype
fig = figure()
ax = fig.add_subplot(111)
ax.plot(a.date, a.adj_close, '-')
fig.autofmt_xdate()
I believe, for the CSV file to be accessed, it has to be placed in the
sample_data folder (for windows). So I placed my csv file in the sample_data
folder and ran the script.
The output was
Traceback (most recent call last):
File "C:\Python26\loadrec.py", line 5, in <module>
datafile = cbook.get_sample_data('ch1.csv', asfileobj=False)
File "C:\Python26\Lib\site-packages\matplotlib\cbook.py", line 662, in
get_sample_data
return myserver.get_sample_data(fname, asfileobj=asfileobj)
File "C:\Python26\Lib\site-packages\matplotlib\cbook.py", line 620, in
get_sample_data
raise KeyError(msg)
KeyError: 'file ch1.csv not in cache; received HTTP Error 404: Not Found
when trying to retrieve'
The data in my CSV file looks like this
0.9963
0
0.499
0.9901
0.0025
0
1
0.0017
1
0.0173
0.9837
If anyone can understand the problem please give me your suggestions. I will
be very thankful if any of you can show me exactly how to scatter plot this
kind of data.
Karthikraja Velmurugan,
Graduate research assistant,
Dept of Biomedical Informatics,
Arizona State University,
248-421-7394
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users