Hi Tara,
On Wed, Mar 17, 2010 at 05:05:10PM +0000, Tara Gilliam wrote:
> Hi,
>
> I've been trying to plot a nested bar chart from some data in a csv file.
> I couldn't find a simple way to swap the column separator from whitespace 
> to comma (I tried tweaking the regexp for the columnpattern, but couldn't 
> get it to work), so I've ended up using graph.data.list instead.
Well, there I know a solution:
If you use "(.*?)(,\s*|\s+|$)" as columnpattern, he will understand:
1,2
1, 2
1,  2
1 2
1  2
so:
 - a commma, followed by an arbitrary (0 or more) number of spaces
 - no comma, but one or more spaces

you can change this separator within one file. The generalized
"minimal.py" reads:

import re
from pyx import *
g = graph.graphxy(width=8)
g.plot(graph.data.file("minimal.dat",
g.plot(graph.data.file("minimal.dat", 
columnpattern=re.compile(r"(.*?)(,\s*|\s+|$)"), x=1, y=2))
g.writeEPSfile("minimal")
g.writePDFfile("minimal")

HTH,

Axel

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to