Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: vapor direku <direku@ho...>  20050629 18:06:55

Thank you Andre, for the reply to my question on the percent sign, it solved my problem. Thank you Simpson as well. My very next question is: How can I color different bands with different colors? E.g. for band in Somewhere g.plot(graph.data.list(band, x=1, y=2), [graph.style.line([style.linewidth.Thin, style.linestyle.solid ])] ) a) how can I use the color palettes to color different bands according to their order b) how can I color them to my will, for example: 1black, 2red, 3green, 4blue... Thanks, D. Ireku _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.clickurl.com/go/onm00200471ave/direct/01/ 
From: vapor direku <direku@ho...>  20050701 15:32:04

Andre, I wrote the loop like this g.plot([graph.data.list(band, x=1, y=2) for band in Somewhere], [graph.style.line([style.linewidth.Thin, style.linestyle.solid, color.palette.RedGreen])]) and I created a list with the favourable colors, for the other case. Thank you for the clarification. Now the new question is: How can I include the color palette, with a proper grading, as a legend? Thanks, D. Ireku _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.clickurl.com/go/onm00200471ave/direct/01/ 
From: Andre Wobst <wobsta@us...>  20050706 13:09:57

Hi, On 02.07.05, vapor direku wrote: > I wrote the loop like this > > g.plot([graph.data.list(band, x=1, y=2) for band in Somewhere], > [graph.style.line([style.linewidth.Thin, style.linestyle.solid, > color.palette.RedGreen])]) Great, that's the way it's intended to be used ... fine! > Now the new question is: How can I include the color palette, with a > proper grading, as a legend? I see. But first of all a style does not provide a continuous description of the palette, it took its colors from. It's nothing a style should take care of. (At least I think so.) This means that for the moment I don't know how we should do this the right way (TM). However, you can *easily* create a palette key and mark the plotitems in their order. You can even use another graph instance for this kind of graph key. As long as you stroke all your data in the graph using the same palette, it'll do the job, because the iteration on the styles will result in the same positions in the palette: #!/usr/bin/env python from pyx import * class palettekey(graph.key.key): def __init__(self, palette, width=1, height=4,**kwargs): graph.key.key.__init__(self, **kwargs) self.palette = palette self.width = width self.height = height def paint(self, plotitems): ticks = [graph.axis.tick.tick(number/(len(plotitems)1.0), label=plotitem.gettitle()) for number, plotitem in enumerate(plotitems) if plotitem.gettitle() is not None] k = graph.graphxy(width=1, height=4, x=graph.axis.lin(parter=None), y=graph.axis.lin(parter=None, manualticks=ticks)) k.plot(graph.data.paramfunction("k", 0, 1, "color, xmin, xmax, y2min, y2max= k, 0, 1, k, 1"), [graph.style.rect(self.palette)]) k.dodata() return k g = graph.graphxy(width=10, key=palettekey(color.palette.Rainbow), x=graph.axis.linear(min=0, max=2), y=graph.axis.linear(min=0, max=2)) g.plot([graph.data.function("x=y**(2**(3%i))" % i) for i in range(3)] + [graph.data.function("y=x**(2**%i)" % i) for i in range(4)], [graph.style.line([color.palette.Rainbow, style.linestyle.clear])]) g.writeEPSfile("palettekey") Note that the example is almost identical to the graph/change example from the PyX webpage except for the new graph key ... André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ 
From: Andre Wobst <wobsta@us...>  20050630 08:27:44

Hi, On 30.06.05, vapor direku wrote: > How can I color different bands with different colors? E.g. > > for band in Somewhere > g.plot(graph.data.list(band, x=1, y=2), > [graph.style.line([style.linewidth.Thin, > style.linestyle.solid ])] ) > > a) how can I use the color palettes to color different bands according to > their order > b) how can I color them to my will, for example: 1black, 2red, 3green, > 4blue... there are different solutions to that. The first would be to explicitly set a color: from pyx import * g = graph.graphxy(width=10) g.plot(graph.data.function("y=sin(x)", min=0, max=10), [graph.style.line([style.linewidth.Thin, style.linestyle.solid, color.gray.black])]) g.plot(graph.data.function("y=cos(x)", min=0, max=10), [graph.style.line([style.linewidth.Thin, style.linestyle.solid, color.rgb.red])]) g.writeEPSfile("colors") But the idea is, that whenever you use the same set of styles in several plot commands or put several data into a single plot command, the styles are "changing" their attribues. from pyx import * g = graph.graphxy(width=10) g.plot([graph.data.function("y=sin(x)", min=0, max=10), graph.data.function("y=cos(x)", min=0, max=10)]) g.writeEPSfile("colors") That's how the linestyle is changed here (its due to the default styles used by for graph.data.function instances). Now, you can do such a thing yourself: from pyx import * g = graph.graphxy(width=10) g.plot([graph.data.function("y=sin(x)", min=0, max=10), graph.data.function("y=cos(x)", min=0, max=10)], [graph.style.line([style.linestyle.clear, color.palette.Rainbow])]) g.writeEPSfile("colors") (Instead of setting the linestyle, I can remove the default linestyle setting of graph.style.line by style.linestyle.clear.) To set up a changeable style yourself, you can do: from pyx import * g = graph.graphxy(width=10) g.plot([graph.data.function("y=sin(x)", min=0, max=10), graph.data.function("y=cos(x)", min=0, max=10)], [graph.style.line([style.linestyle.clear, attr.changelist([color.gray.black, color.rgb.red])])]) g.writeEPSfile("colors") Of course you can store those changeable attribues or graph styles etc. and use them again and again. And I do know, that we're currently lacking some documentation about the attribute features ... :( André  by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX  High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ 
Sign up for the SourceForge newsletter:
No, thanks