3d bar graphs (without occlusion)
[PyX.git] / www / png / example.py
blob3a6d5499885d40de5bbbd2c22952108888cadef5
1 import math
2 from pyx import *
4 class rgbgradient(color.lineargradient):
6 def getcolor(self, x):
7 return color.lineargradient.getcolor(self, x).rgb()
9 rgbHue = rgbgradient(color.hsb(0, 1, 1), color.hsb(1, 1, 1))
11 class phasecolorsurface(graph.style.surface):
13 def midcolor(self, *c):
14 return math.atan2(sum([math.sin(x) for x in c]), sum([math.cos(x) for x in c]))
16 g = graph.graphxyz(size=3.5, zscale=0.3, projector=graph.graphxyz.central(3, 25, 8),
17 x=graph.axis.lin(painter=None),
18 y=graph.axis.lin(painter=None),
19 z=graph.axis.lin(painter=None),
20 x2=None, y2=None)
21 g.plot(graph.data.file("example.dat", x=1, y=2, z=3, color=4), [phasecolorsurface(gradient=rgbHue, backcolor=color.rgb.black)])
22 g.writeEPSfile("example")