Heya, I'm trying to make color graphs of complex functions but seem to have problems with hsb gradients. (I want to use an hsb gradient in order to map arguments/phases of complex numbers to something periodic, such as the meaning of h in hsb.)
There seems to be a problem around param = 0 or 1, though. The following should be true for small eps (0 < eps < 1./6): hsb( eps, 1, 1).rgb() == rgb(1, 6*eps, 0) hsb(1-eps, 1, 1).rgb() == rgb(1, 0, 6*eps) And I don't think pyx.color is failing me here, but just look at the phase plot of f(z)=z: Weird stuff happening along the negative real axis where, admittedly, cmath.phase(z) jumps, but everything looks nice with other gradients, and hsb sprinkles in "positive real color" all over the negative real axis. What is going on? Michael
from pyx import *
import math,cmath
N=8
class FullSaturationCCW(color.gradient):
def __init__(self):
self.colorclass = color.rgb
def getcolor(self, param):
return color.gradient.Hue.getcolor(param).rgb()
g = graph.graphxy(width = 8, height = 8)
xs = [ (2.0*i/N) for i in range(-N, N+1) ]
ys = xs[:]
pointlist = [ [x, y, cmath.phase(x+1j*y)] for x in xs for y in ys ]
g.plot(graph.data.points(pointlist, x=1, y=2, color=3),
[graph.style.surface(gradient=FullSaturationCCW(),
mincolor=-math.pi,maxcolor=math.pi,backcolor=color.rgb.black)])
g.writeEPSfile(__file__[:-3])
g.writePDFfile(__file__[:-3])
<<attachment: hsb.png>>
------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev
_______________________________________________ PyX-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-devel
