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.
Plotting a simple bar graph is fine, but when I switch to using nestedbar() so
that the columns don't overlap, I get a TypeError from the xname argument.
data.list() seems to be calling abs() expecting a number rather than the string
format used for axis selection. The check involved isn't made in data.file(), so
that completes without issue.
I tried the nestedbar example in the documentation and the file read is replaced
with a list(), exactly the same problem occurs - I've attached the code/data files.
I checked svn in case it was different, but although the code has been moved to
data.points(), the same check seems to be there:
0.10: graph.data.list, line 135
svn trunk: graph.data.points, line 154
http://pyx.svn.sourceforge.net/viewvc/pyx/trunk/pyx/pyx/graph/data.py?view=markup
I've tried giving xname as just a number, as a tuple, and with the string format
from the example, but invariably get an error requesting one of the other types.
Am I using something incorrectly, or is there a workaround for this?
Thanks,
Tara
from pyx import *
# copied from minimal.dat, with an extra column
data = [[1,2,17],
[2,3,6],
[3,8,14],
[4,13,14],
[5,18,12],
[6,21,23]]
# original compare example
g = graph.graphxy(width=8, x=graph.axis.nestedbar())
g.plot([graph.data.file("minimal.dat", xname="$0, 0", y=2),
graph.data.file("minimal.dat", xname="$0, 1", y=3)],
[graph.style.bar()])
g.writePDFfile("fromFile")
# replace file read with same data in a list
g = graph.graphxy(width=8, x=graph.axis.nestedbar())
g.plot([graph.data.list(data, xname="$0, 0", y=2),
graph.data.list(data, xname="$0, 1", y=3)],
[graph.style.bar()])
g.writePDFfile("fromList")
1 2 17
2 3 6
3 8 14
4 13 14
5 18 12
6 21 23
------------------------------------------------------------------------------
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