fill-between special demand

Hello,

I know that it is possible to fill an area between to curves (functions) with "fill between".

In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility...

I hope a made myself clear enough...and hopefully you can help me.

/Johannes

···

--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone

Hi,

use numpy to calculate the upper and lower limits first?

curves = np.random.randn(1000, 10)
plt.fill_between(np.arange(1000), curves.min(1), curves.max(1))

of course if the x values ar enot all the same you will have to
interpolate...

Regards,

Sebastian

···

On Fri, 2011-06-10 at 14:15 +0200, Johannes Radinger wrote:

Hello,

I know that it is possible to fill an area between to curves (functions) with "fill between".

In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility...

I hope a made myself clear enough...and hopefully you can help me.

/Johannes

-------- Original-Nachricht --------

Datum: Fri, 10 Jun 2011 14:40:17 +0200
Von: Sebastian Berg <sebastian@...3476...>
An: Johannes Radinger <JRadinger@...1843...>
CC: matplotlib-users@lists.sourceforge.net
Betreff: Re: [Matplotlib-users] fill-between special demand

> Hello,
>
> I know that it is possible to fill an area between to curves (functions)
with "fill between".
>
> In my case I've got let's say 10 curves of different shape. I'd like to
fill the area between the most upper lines and the most lower lines. Is
that somehow possible? One work-around which appeared in my mind was to use
fill-between for all possible combinations of 2 functions out of the 10, but
thats somehow stupid work if there is another possibility...
>
> I hope a made myself clear enough...and hopefully you can help me.
>
> /Johannes

Hi,

use numpy to calculate the upper and lower limits first?

curves = np.random.randn(1000, 10)
plt.fill_between(np.arange(1000), curves.min(1), curves.max(1))

hmm. I am not sure what you mean exactly. In my case i've got following function:

def pdf(x,s1,s2,p):
    return (p/(math.sqrt(2*math.pi*s1**2))*numpy.exp(-((x-0)**(2)/(2*s1**(2)))))+((1-p)/(math.sqrt(2*math.pi*s2**2))*numpy.exp(-((x-0)**(2)/(2*s2**(2)))))

and s1,s2 and p are varying... so i have a list like
123, 3215, 0.3
152, 2351, 0.4
521, 4351, 0.6
...
for these three parameters. So the resulting curves are probably intersecting each other and are of different shape.

so two questions:

1) what is the best way to supply this list to produce the single curves (about 10)

2) how can I do the fill between to get the "range" of the curves. Maybe you can give me a more detailed example.

Thanks

/Johannes

···

On Fri, 2011-06-10 at 14:15 +0200, Johannes Radinger wrote:

of course if the x values ar enot all the same you will have to
interpolate...

Regards,

Sebastian

--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone