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: Joerg Lehmann <joergl@us...>  20130830 10:00:48

Hi Michael, First of all, I think this is something that would also be useful for the examples or the gallery. Your code can be simplified a bit though, because the << operator (respectively PS/PDF) will add straight lines automatically and the closepath is automatically done while filling. Concerning the second graph: We should find a way that this is not necessary. In principle, there already is deco.stroked.clear, which prevents stroking of the path. See my attached new version. However, this currently does not work because PyX will complain about the fact that the path is neither stroked nor filled. This is an explicit check, we could remove (see line 237 in the latest pyx/deco.py). André, what do you think? Cheers, Jörg On 29.08.13, Michael SCHINDLER wrote: > Hello Néstor, > > On 28/08/13, Néstor Espinoza wrote: > > I'm trying to draw confidence bands around some model datapoints that I > > have and I think the tutorials that I've read so far that paint areas below > > curves are not what I'm looking for (e.g., > > http://pyx.sourceforge.net/gallery/graphs/integral.html), because in order > > to paint areas between curves with those methods (i.e., by the method > > suggested in this same mailist here: > > http://osdir.com/ml/python.pyx.users/200807/msg00002.html), the trick is > > to paint white below the second curve. > > I am not quite sure to understand what you want to do. If it is just > to visualize the confidence of the data, you could use simple error > bars (http://pyx.sourceforge.net/examples/graphstyles/errorbar.html). > I you want it more fancy with a shaded area, the principle is the same > as in the integral example: You take out the paths from the graph, and > those can be manipulated (glued together, split, ...). If this latter > step makes problems, have a look at the joint example. > > > Basically in my code I have three vectors, model, model_down and model_up. > > The idea is to plot the confidence bands between the curves model_down and > > model_up (which represent my confidence bads) and plot model as datapoints > > on top: do you have any idea on how to do this? > > Best, > Michael > > import sys, os > sys.path.insert(0, os.path.expanduser("~/python/PyX0.12.1")) > import pyx > print pyx.version.version # need 0.12 for canvas layers > from pyx import * > > N = 30 > xs = [10.0 * i/(N1) for i in range(N)] > model = [(x3)*(x5)*(x7) for x in xs] > model_upp = [y + 10 for y in model] > model_low = [y  10 for y in model] > > g = graph.graphxy(width=10, > x=graph.axis.linear(title="$x$"), > y=graph.axis.linear(title="$y$")) > g.plot(graph.data.values(x=xs, y=model)) > # we need another (identical) graph to avoid plotting lines around the confidence area: > h = graph.graphxy(width=10, x=graph.axis.linkedaxis(g.axes["x"]), y=graph.axis.linkedaxis(g.axes["y"])) > dupp = h.plot(graph.data.values(x=xs, y=model_upp), [graph.style.line()]) > dlow = h.plot(graph.data.values(x=xs, y=model_low), [graph.style.line()]) > h.doplot() > > upp = dupp.path.reversed() > low = dlow.path > x0, y0 = low.atend() > x1, y1 = upp.atbegin() > connect1 = path.line(x0, y0, x1, y1) > > area = low << connect1 << upp > area.append(path.closepath()) > > g.layer("filldata").draw(area, [deco.filled([color.gray(0.8)])]) > g.writePDFfile("mini") > >  > Learn the latestVisual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of stepbystep > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > PyXuser mailing list > PyXuser@... > https://lists.sourceforge.net/lists/listinfo/pyxuser 