<div dir="ltr">If you are trying to read a CSV file, I strongly suspect using pandas for ingesting them. <div><br></div><div><a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html">http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html</a><br><div><br></div><div>Also, please use the new mailing list at <a href="mailto:matplotlib-users@python.org">matplotlib-users@python.org</a>.</div><div><br></div><div>Tom</div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 14, 2015 at 1:39 PM Anthony Rollett <<a href="mailto:rollett@andrew.cmu.edu">rollett@andrew.cmu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
regards<br>
Tony Rollet<br>
<br>
> #!/usr/bin/env python<br>
> """<br>
> simple line/scatter plot.<br>
> """<br>
> import matplotlib<br>
> import numpy as np<br>
> import <a href="http://matplotlib.cm" rel="noreferrer" target="_blank">matplotlib.cm</a> as cm<br>
> import matplotlib.mlab as mlab<br>
> import matplotlib.pyplot as plt<br>
> from numpy import *<br>
> import scipy.interpolate<br>
><br>
> isosphere = genfromtxt("KAM_test_5Oct14strs_strn.txt", names=True )<br>
<br>
<br>
<br>
On Aug 14, 2015, at 12:05 PM, Kevin Parks <<a href="mailto:kp8@me.com" target="_blank">kp8@me.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> 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?)<br>
><br>
> I also have never opened a file this way. I had prevously just used something like:<br>
><br>
> for l in open(filename).readlines():<br>
>   l = l.strip().split()<br>
>   data.append([float(l[0]), float(l[1]), float(l[2]), int(l[3])])<br>
><br>
> values = [1,2,3,4]<br>
><br>
> -<br>
><br>
> I think ithis is just some example file that gets installed some place so that the examples work?<br>
><br>
> What does asfileobj=False do?<br>
><br>
> Goodness the whole world of Python has radically changed in the short time I have been out of the game.<br>
><br>
><br>
><br>
>> On Aug 15, 2015, at 1:50 AM, Christian Alis <<a href="mailto:ianalis@gmail.com" target="_blank">ianalis@gmail.com</a>> wrote:<br>
>><br>
>> The sample code reads data from msft.csv. If you enter your data into<br>
>> a text editor and save it as msft.csv in python's current working<br>
>> directory, then the following minimal code (pruned from plotfile_demo)<br>
>> should work:<br>
>><br>
>> from pylab import plotfile, show, gca<br>
>> import matplotlib.cbook as cbook<br>
>><br>
>> fname = cbook.get_sample_data('msft.csv', asfileobj=False)<br>
>><br>
>> #test 5; single subplot<br>
>> plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)<br>
>><br>
>> show()<br>
>><br>
><br>
><br>
> ------------------------------------------------------------------------------<br>
> _______________________________________________<br>
> Matplotlib-users mailing list<br>
> <a href="mailto:Matplotlib-users@lists.sourceforge.net" target="_blank">Matplotlib-users@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br>
<br>
<br>
------------------------------------------------------------------------------<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@lists.sourceforge.net" target="_blank">Matplotlib-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br>
</blockquote></div></div></div></div>