> On 08.03.06, Alan G Isaac wrote:
>> I thought this meant I could do:
>> mystyle =
>> [pyx.graph.style.bar(barattrs=[pyx.attr.changelist([pyx.color.rgb.red,
>> pyx.color.rgb.green])])]
>> g.plot(
>> pyx.graph.data.list(zip(Xnames,Yvals), xname=1, y=2),
>> mystyle
>> )
On Thu, 9 Mar 2006, Andre Wobst apparently wrote:
> Yeah, but you need to use the style on several datasets
> (i.e. some data instances) to make sense out of the
> changeable attribute.
Sure. But I cannot even get the first instance to work.
See below.
Thanks,
Alan
############# script ################################
import pyx
print "PyX version: ", pyx.__version__
g = pyx.graph.graphxy(width=8,
x=pyx.graph.axis.bar(),
y=pyx.graph.axis.linear(min=0,
max=10,
parter=None,
manualticks=[pyx.graph.axis.tick.tick(10*xi/5) for xi in range(6)]))
# this works fine:
mystyle = pyx.graph.style.bar(barattrs=[pyx.color.rgb.green])
# this works not at all:
mystyle = pyx.graph.style.bar(barattrs=[pyx.attr.changelist([pyx.color.rgb.red,
pyx.color.rgb.green])])
g.plot(pyx.graph.data.list(zip(["two","four","six"],[2,4,6]),xname=1,y=2),
[mystyle])
g.writeEPSfile("c:\\temp\\temp.eps")
############# script output ########################
PyX version: 0.8.1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\temp.py", line 15, in ?
g.writeEPSfile("c:\\temp\\temp.eps")
File "C:\Python24\lib\site-packages\pyx\canvas.py", line 323, in wrappedindocu
ment
return method(d, filename)
File "C:\Python24\lib\site-packages\pyx\document.py", line 138, in writeEPSfil
e
pswriter.epswriter(self, filename, *args, **kwargs)
File "C:\Python24\lib\site-packages\pyx\pswriter.py", line 235, in __init__
bbox = page.bbox()
File "C:\Python24\lib\site-packages\pyx\document.py", line 78, in bbox
bbox = self.canvas.bbox()
File "C:\Python24\lib\site-packages\pyx\graph\graph.py", line 445, in bbox
self.finish()
File "C:\Python24\lib\site-packages\pyx\graph\graph.py", line 342, in finish
self.domethods[0]()
File "C:\Python24\lib\site-packages\pyx\graph\graph.py", line 320, in dodata
plotitem.draw(self)
File "C:\Python24\lib\site-packages\pyx\graph\graph.py", line 107, in draw
style.drawpoint(privatedata, self.sharedata, graph, point)
File "C:\Python24\lib\site-packages\pyx\graph\style.py", line 1430, in drawpoi
nt
privatedata.rectcanvas.fill(p, privatedata.barattrs)
File "C:\Python24\lib\site-packages\pyx\canvas.py", line 290, in fill
self.draw(path, [deco.filled]+list(attrs))
File "C:\Python24\lib\site-packages\pyx\canvas.py", line 253, in draw
attrs = attr.mergeattrs(attrs)
File "C:\Python24\lib\site-packages\pyx\attr.py", line 60, in mergeattrs
raise TypeError("only instances of class attr.attr are allowed")
TypeError: only instances of class attr.attr are allowed
>>>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user