Maybe using “genfromtxt" is simpler as a way to get going, see below for a 
fragment of script?  It should be able to read a CSV file since it’s just a 
comma delimited text file. You might need to look up how to set the delimiter 
character.
regards
Tony Rollet

> #!/usr/bin/env python
> """
> simple line/scatter plot.
> """
> import matplotlib
> import numpy as np
> import matplotlib.cm as cm
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
> from numpy import *
> import scipy.interpolate
> 
> isosphere = genfromtxt("KAM_test_5Oct14strs_strn.txt", names=True )



On Aug 14, 2015, at 12:05 PM, Kevin Parks <k...@me.com> wrote:

> Hi,
> 
> That doesn’t work. Just having my own msft.csv file in my directory doesn't 
> change anything as it is still pointing to some other msft.csv someplace on 
> my computron. (what and where is this file?)
> 
> I also have never opened a file this way. I had prevously just used something 
> like:
> 
> for l in open(filename).readlines():
>   l = l.strip().split()
>   data.append([float(l[0]), float(l[1]), float(l[2]), int(l[3])])
> 
> values = [1,2,3,4]
> 
> -
> 
> I think ithis is just some example file that gets installed some place so 
> that the examples work?
> 
> What does asfileobj=False do?
> 
> Goodness the whole world of Python has radically changed in the short time I 
> have been out of the game. 
> 
> 
> 
>> On Aug 15, 2015, at 1:50 AM, Christian Alis <iana...@gmail.com> wrote:
>> 
>> The sample code reads data from msft.csv. If you enter your data into
>> a text editor and save it as msft.csv in python's current working
>> directory, then the following minimal code (pruned from plotfile_demo)
>> should work:
>> 
>> from pylab import plotfile, show, gca
>> import matplotlib.cbook as cbook
>> 
>> fname = cbook.get_sample_data('msft.csv', asfileobj=False)
>> 
>> #test 5; single subplot
>> plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)
>> 
>> show()
>> 
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to