Hi, thanks a lot for the help. I actually succeeded in changing the color but
I didn't notice that (due to a silly mistake), my colors only varies between
gray(1.0) to gray(0.95) which my eyes see as the same color. As result, I
thought that I misunderstand the docs somehow.
Anyway, I try the color.palette.Rainbow for better colors but It gave a
ZeroDivisionError. Could you help again this time. Or is it a bug?
Here is the program (the data for one plot are all in one line, x1 y1 x2
y2 , different lines correspond to different plots, 14 plots in total):
===================================
from pyx import *
g = graph.graphxy(width=8, key=graph.key.key(pos="br"),
x=graph.axis.log()
)
finfile = open('all.dat')
for i in range(14):
data= finfile.readline().split()
d = []
for idx in range(7,93,4):
d.append([float(data[idx]),float(data[idx+2])])
mytitle = "$"+data[1]+"/"+data[2]+"$"
g.plot(graph.data.list(d, x=1, y=2, title=mytitle),
[ graph.style.line( [style.linewidth.THIN,color.palette.Rainbow] ) ]
)
g.writeEPSfile('EvsG_75.eps')
====================================
And here is the error:
Traceback (most recent call last):
File "EvsGamma.py", line 32, in ?
g.writeEPSfile('EvsG_75.eps')
File "/usr/lib64/python2.3/site-packages/pyx/canvas.py", line 424, in
writeEPSfile
abbox = bbox is not None and bbox or self.bbox()
File "/usr/lib64/python2.3/site-packages/pyx/graph/graph.py", line 496, in
bbox
self.finish()
File "/usr/lib64/python2.3/site-packages/pyx/graph/graph.py", line 436, in
finish
self.domethods[0]()
File "/usr/lib64/python2.3/site-packages/pyx/graph/graph.py", line 323, in
dolayout
plotitem.selectstyles(self, styleindex[stylesid(plotitem.styles)],
styletotal[stylesid(plotitem.styles)])
File "/usr/lib64/python2.3/site-packages/pyx/graph/graph.py", line 183, in
selectstyles
style.selectstyle(privatedata, self.sharedata, graph, selectindex,
selecttotal)
File "/usr/lib64/python2.3/site-packages/pyx/graph/style.py", line 471, in
selectstyle
privatedata.lineattrs = attr.selectattrs(self.defaultlineattrs +
self.lineattrs, selectindex, selecttotal)
File "/usr/lib64/python2.3/site-packages/pyx/attr.py", line 209, in
selectattrs
select = a.select(index, total)
File "/usr/lib64/python2.3/site-packages/pyx/color.py", line 218, in select
return self.getcolor(index/(total-1.0))
ZeroDivisionError: float division
|