Hi André,

On 30.08.13, André Wobst wrote:
> I like the code, and I think it is a useful example. So yes, I agree, it is a 
> good example or gallery contribution. I'm slightly addicted to make it an 
> example.
> 
> Regarding the issue with the decorated path not being stroked nor filled, the 
> solution is rather simple. You can set the lineattr to None to skip stroking. 
> This is a common way to turn off an output in the graph while all work 
> related to generating the output is still in place (thus the path for the 
> line is still generated).
> 
> I favor to keep the error in the decorated path. While I could slightly 
> simplify some graph code, it is still strange to draw a path without actually 
> creating output. In addition, would this "output" still contribute to the 
> bounding box or not?! And last but not least, take the regular user, who 
> might accidentally call draw without a stroke or fill decorator. I prefer to 
> raise an error for that case. This code was written with Jörg and me together 
> (IIRC), and I'm pretty sure we discussed the pro and contra and putted the 
> exception on purpose in the end.

Concerning the bounding box handling, you're right. That also
immediately came to my mind. Still, I wondered why there is 
deco.stroked.clear - and why it did not work.

But fair enough. Let's use lineattr=None. It is better anyways. I just
did not think about it.

Attached is a new version.

Cheers,

        Jörg

> 
> Best,
> 
> 
> André
> 
> 
> Am 30.08.2013 um 12:00 schrieb Joerg Lehmann:
> 
> > 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 data-points 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/2008-07/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/PyX-0.12.1"))
> >> import pyx
> >> print pyx.version.version # need 0.12 for canvas layers
> >> from pyx import *
> >> 
> >> N = 30
> >> xs = [10.0 * i/(N-1) for i in range(N)]
> >> model = [(x-3)*(x-5)*(x-7) 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 latest--Visual 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 step-by-step
> >> tutorial videos with LearnDevNow. Subscribe today and save!
> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> > 
> >> _______________________________________________
> >> PyX-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/pyx-user
> > 
> > <mini2.py>------------------------------------------------------------------------------
> > Learn the latest--Visual 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 step-by-step
> > tutorial videos with LearnDevNow. Subscribe today and save!
> > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk_______________________________________________
> > PyX-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/pyx-user
> 
> -- 
> by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
>    / \ \    / )   [email protected], http://www.wobsta.de/
>   / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
>  (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/
> 



> ------------------------------------------------------------------------------
> Learn the latest--Visual 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 step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk

> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user


------------------------------------------------------------------------------
Learn the latest--Visual 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 step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to