## Re: [PyX-user] Plot data on shaded area

 Re: [PyX-user] Plot data on shaded area From: Axel Freyn - 2008-07-10 07:52:54 Attachments: Message as HTML ```Hi Mirco and Stefan, On Thu, Jul 10, 2008 at 8:28 AM, Stefan Schenk < Stefan.Schenk@...> wrote: > Am Mittwoch 09 Juli 2008 23:32 schrieb Mico Filós: > > I want to plot some data curves on a graph that contains a filled area. > > Imagine for example that in > > http://pyx.sourceforge.net/gallery/graphs/integral.py > > I want to plot, apart from the curve (x,f(x)) and the area under it, > > another curve (x,g(x)). > > To define the area I need to finish the graph, to make the paths > > available. But then the area covers > > my data curves... How could I solve this? > > > > My feeling is that I am missing something trivial :) > > > > > > figure.plot(graph.data.list(...)) > > figure.finish() > > > > # Define my area > > area = ... > > figure.fill(area) # The curves are under the area > > > > I have tried to assign the paths to some variables, to stroke them > > after calling figure.finish, > > but it does seem to work. > > > You got the correct idea. You have to stroke the paths after you painted > the area. However this is not possible after finish() in the same graphxy > object. But you can extract the curves from figure and just use a new > canvas like in http://pyx.sourceforge.net/gallery/graphs/partialfill.html > > I think, there is even a simpler way: it is not necessary to call g.finish() in the example code integral.py, it is sufficient just to plot the plotitem "d" by calling g.doplot(d) instead. After that, the path is accessible. So the following should work (in integral.py): ... d = g.plot(graph.data.function("y(x)=(x-3)*(x-5)*(x-7)")) d1 = g.plot(graph.data.function("y(x)=(x-3)*(x-5)*(x-9)")) g.doplot(d) p = d.path # the path is available after the plotitem is plotted [ fill the area below d ] g.doplot(d1) p1 = d1.path # the path is available after the plotitem is plotted [ fill the area below d1 ] ... With that, the second function is plotted on top of the area below d1 HTH, Axel ```

 [PyX-user] Plot data on shaded area From: Mico Filós - 2008-07-09 21:32:02 ```Hi, I want to plot some data curves on a graph that contains a filled area. Imagine for example that in http://pyx.sourceforge.net/gallery/graphs/integral.py I want to plot, apart from the curve (x,f(x)) and the area under it, another curve (x,g(x)). To define the area I need to finish the graph, to make the paths available. But then the area covers my data curves... How could I solve this? My feeling is that I am missing something trivial :) figure.plot(graph.data.list(...)) figure.finish() # Define my area area = ... figure.fill(area) # The curves are under the area I have tried to assign the paths to some variables, to stroke them after calling figure.finish, but it does seem to work. Thanks so much, Mico ```
 Re: [PyX-user] Plot data on shaded area From: Stefan Schenk - 2008-07-10 06:29:04 Attachments: Message as HTML ```Hi Mico, Am Mittwoch 09 Juli 2008 23:32 schrieb Mico Filós: > I want to plot some data curves on a graph that contains a filled area. > Imagine for example that in > http://pyx.sourceforge.net/gallery/graphs/integral.py > I want to plot, apart from the curve (x,f(x)) and the area under it, > another curve (x,g(x)). > To define the area I need to finish the graph, to make the paths > available. But then the area covers > my data curves... How could I solve this? > > My feeling is that I am missing something trivial :) > > > figure.plot(graph.data.list(...)) > figure.finish() > > # Define my area > area = ... > figure.fill(area) # The curves are under the area > > I have tried to assign the paths to some variables, to stroke them > after calling figure.finish, > but it does seem to work. You got the correct idea. You have to stroke the paths after you painted the area. However this is not possible after finish() in the same graphxy object. But you can extract the curves from figure and just use a new canvas like in http://pyx.sourceforge.net/gallery/graphs/partialfill.html Greetings, Stefan ```
 Re: [PyX-user] Plot data on shaded area From: Axel Freyn - 2008-07-10 07:52:54 Attachments: Message as HTML ```Hi Mirco and Stefan, On Thu, Jul 10, 2008 at 8:28 AM, Stefan Schenk < Stefan.Schenk@...> wrote: > Am Mittwoch 09 Juli 2008 23:32 schrieb Mico Filós: > > I want to plot some data curves on a graph that contains a filled area. > > Imagine for example that in > > http://pyx.sourceforge.net/gallery/graphs/integral.py > > I want to plot, apart from the curve (x,f(x)) and the area under it, > > another curve (x,g(x)). > > To define the area I need to finish the graph, to make the paths > > available. But then the area covers > > my data curves... How could I solve this? > > > > My feeling is that I am missing something trivial :) > > > > > > figure.plot(graph.data.list(...)) > > figure.finish() > > > > # Define my area > > area = ... > > figure.fill(area) # The curves are under the area > > > > I have tried to assign the paths to some variables, to stroke them > > after calling figure.finish, > > but it does seem to work. > > > You got the correct idea. You have to stroke the paths after you painted > the area. However this is not possible after finish() in the same graphxy > object. But you can extract the curves from figure and just use a new > canvas like in http://pyx.sourceforge.net/gallery/graphs/partialfill.html > > I think, there is even a simpler way: it is not necessary to call g.finish() in the example code integral.py, it is sufficient just to plot the plotitem "d" by calling g.doplot(d) instead. After that, the path is accessible. So the following should work (in integral.py): ... d = g.plot(graph.data.function("y(x)=(x-3)*(x-5)*(x-7)")) d1 = g.plot(graph.data.function("y(x)=(x-3)*(x-5)*(x-9)")) g.doplot(d) p = d.path # the path is available after the plotitem is plotted [ fill the area below d ] g.doplot(d1) p1 = d1.path # the path is available after the plotitem is plotted [ fill the area below d1 ] ... With that, the second function is plotted on top of the area below d1 HTH, Axel ```
 Re: [PyX-user] Plot data on shaded area From: Mico Filós - 2008-07-10 09:15:23 ```Thanks Axel and Stefan for your quick answer. It now works :) ```
 Re: [PyX-user] Plot data on shaded area From: Alan G Isaac - 2008-07-31 20:40:48 ```On Thu, 10 Jul 2008, Axel Freyn apparently wrote: > g.doplot(d) I think you mean ``doplotitem``. Question: does ``doplotitem`` only construct the path or also paint it? (I seem to be finding the latter.) Thank you, Alan Isaac ```