Re: [PyX-user] plot a box filled with a gradient??

 Re: [PyX-user] plot a box filled with a gradient?? From: Stefan Schenk - 2007-07-19 05:57:54 ```Hi, Am Mittwoch 18 Juli 2007 21:04 schrieb Imran Rashid: > But I want to add a key to the graph, that would show how the color > corresponds to the numerical value. > > is there anyway to do this? Of course there is. Here is some code snippet i used some time ago for doing something similar. gridx = gridy = 50 c = canvas.canvas() # ... pal = [] for i in range(gridy): pal.append([0, 0.5, i*0.5/gridy, (i+1)*0.5/gridy, i*1.0/gridy]) gp = c.insert(graph.graphxy(height=2, width=0.5, xpos=12.5, ypos=4, x=graph.axis.linear(parter=None), y=graph.axis.linear(min=0, max=0.5, density=0.5))) gp.plot(graph.data.list(pal, xmin=1, xmax=2, ymin=3, ymax=4, color=5), [graph.style.rect(color.palette.ReverseRainbow)]) HTH, Stefan ```

 [PyX-user] plot a box filled with a gradient?? From: Imran Rashid - 2007-07-18 19:04:43 ```Hi, I can't figure out how to get PyX to plot a rectangle filled with a color gradient (eg., so that the color varies as y varies). I want to use this is a key for a graph. I have some 3D data that I'd like to plot as a 2D scatter plot, and show the last dimension with the color of each point. I think I can follow this example: http://pyx.sourceforge.net/examples/graphstyles/changesymbol.html to take care of the plotting. But I want to add a key to the graph, that would show how the color corresponds to the numerical value. is there anyway to do this? thanks, Imran ```
 Re: [PyX-user] plot a box filled with a gradient?? From: Stefan Schenk - 2007-07-19 05:57:54 ```Hi, Am Mittwoch 18 Juli 2007 21:04 schrieb Imran Rashid: > But I want to add a key to the graph, that would show how the color > corresponds to the numerical value. > > is there anyway to do this? Of course there is. Here is some code snippet i used some time ago for doing something similar. gridx = gridy = 50 c = canvas.canvas() # ... pal = [] for i in range(gridy): pal.append([0, 0.5, i*0.5/gridy, (i+1)*0.5/gridy, i*1.0/gridy]) gp = c.insert(graph.graphxy(height=2, width=0.5, xpos=12.5, ypos=4, x=graph.axis.linear(parter=None), y=graph.axis.linear(min=0, max=0.5, density=0.5))) gp.plot(graph.data.list(pal, xmin=1, xmax=2, ymin=3, ymax=4, color=5), [graph.style.rect(color.palette.ReverseRainbow)]) HTH, Stefan ```