From: Axel Freyn <freynaxe@us...>  20090206 09:41:08

Hi Patrik, > I'm trying to get started making some more advanced plots with PyX. What I > want to do is create a plot with some lines on it, where each line is > surrounded by a halftransparent filled area (the 1sigma deviation around > the line). (For an example see > http://governator.ucsc.edu/filer/p04tau100variance.png, which was made with > matplotlib.) > > The strategy I'm using is based on the "integral" example, ie: > > plot lines > retrieve paths from plotitems > create closed paths and fill them I'm not convinced that my strategy is the "best" or "official"  but at least it seems to work;) from pyx import * g = graph.graphxy(width=8, x=graph.axis.linear(min=0, max=2), y=graph.axis.linear(min=0, max=2), key=graph.key.key(pos="br", dist=0.1)) g.plot([graph.data.function("x(y)=y**4", title=r"$x = y^4$"), graph.data.function("x(y)=y**2", title=r"$x = y^2$"), graph.data.function("x(y)=y", title=r"$x = y$"), graph.data.function("y(x)=x**2", title=r"$y = x^2$"), graph.data.function("y(x)=x**4", title=r"$y = x^4$")], [graph.style.line([color.gradient.Rainbow])]) g.finish() # Now, we search the properties of plotimes until we find the colours.. colors = {} for i in g.plotitems: for s in i.privatedatalist: if s.__dict__.has_key('lineattrs'): for c in s.__dict__['lineattrs']: if isinstance(c,pyx.color.color): colors[i.title] = c This wil create a dictionary, containg all title>color relations. Then there are 2 possibilites: a) you create the closed paths from parallel shifts of the original path. Then you can just use the graph as a canvas an continue plotting there (using the canvasmethods, no longer the plotroutines) b) you create the closed paths also by g.plotRoutines. Then, the easiest way is probably to create a new graphxyObject, and plot everything there, as now you know already the colors But I'm sure, there are better ways to achive this result;) Good Luck Axel 