problem with fill_between in combination with line plot

Hey Matplotlib Community,

         I am trying to create a standard line plot and then overlay a fill_between plot that would partly grey out the line plot. The code snippet I am interested in is:

import matplotlib.pyplot as plot
fig = plot.figure()
p1 = fig.add_subplot(111)
p1.plot(x,y1,'r',linewidth=5)
p1.fill_between(x,0,y2,color='k',alpha='0.7')

However, the fill_between plot is not actually covering the line plot. Is there another keyword I should be using?

Thanks!
Terry

···

--
P. Therese Lang
Post Doc
Alber Lab, UC Berkeley

Hello, in the plot commands you can control what covers what by using
the zorder parameter. Here's a demo:
http://matplotlib.sourceforge.net/examples/pylab_examples/zorder_demo.html

So, in your case you could change the plotting commands to

p1.plot(x,y1,'r',linewidth=5,zorder=1)
p1.fill_between(x,0,y2,color='k',alpha='0.7',zorder=2)

to get the fill to cover the line plot.

···

On Wed, Mar 30, 2011 at 3:16 AM, Terry Lang <terry@...3519...> wrote:

Hey Matplotlib Community,

    I am trying to create a standard line plot and then overlay a

fill_between plot that would partly grey out the line plot. The code
snippet I am interested in is:

import matplotlib.pyplot as plot
fig = plot.figure()
p1 = fig.add_subplot(111)
p1.plot(x,y1,'r',linewidth=5)
p1.fill_between(x,0,y2,color='k',alpha='0.7')

However, the fill_between plot is not actually covering the line plot.
Is there another keyword I should be using?

Thanks!
Terry

--
P. Therese Lang
Post Doc
Alber Lab, UC Berkeley

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Valentine Svensson

+46735011518
valentine@...3522...