Just a follow-up: I managed to interpolate this problem away...

      interpolated = []
      iinds = []
      for i in range(len(stockData.rinds)-1):
         interpolated.append(s[stockData.rinds[i]])
         iinds.append(stockData.inds[i])
         interpolated.append((s[stockData.rinds[i]]*3. + 
s[stockData.rinds[i]+1])/4)
         iinds.append(stockData.inds[i] + 0.25)
         interpolated.append((s[stockData.rinds[i]] + 
s[stockData.rinds[i]+1])/2)
         iinds.append(stockData.inds[i] + 0.5)
         interpolated.append((s[stockData.rinds[i]] + 3.* 
s[stockData.rinds[i]+1])/4)
         iinds.append(stockData.inds[i] + 0.75)
      interpolated.append(s[stockData.rinds[len(stockData.rinds)-1]])
      iinds.append(stockData.inds[len(stockData.inds)-1])
      interpolated = array(interpolated)

      ax.fill_between(iinds, interpolated, 50-thresh, 
where=interpolated<50-thresh, color=color, alpha=0.3 )

It would be nice to see this taken care of intelligently inside the 
fill_between routine, but I wouldn't know how to do it for the general case. 
Maybe this post will allow future users with a similar problem to find their 
answer.

-Ryan



From: Ryan Wagner
Sent: Wednesday, February 25, 2009 5:06 PM
To: 'matplotlib-users@lists.sourceforge.net'
Subject: Bug in Fill_Between?


Is this a bug in fill_between, or is there a known workaround?

In the attached picture, I'm calling fill_between as follows, and I can't fill 
the entire area between the line (50+thresh) and the signal, s. I realize that 
the areas that aren't filled are boundary conditions, but there should be some 
sort of interpolation I can do to fix this I would think...

      ax.fill_between(stockData.inds, s[stockData.rinds], 50+thresh, 
where=s[stockData.rinds]>50+thresh, color=color, alpha=0.3 )


So for example: stockData.inds = range(6),  s[stockData.rinds] = 
[20,30,70,80,40,20] and thresh = 0. I need the areas filled with color where 
stockData.rinds is greater than 50. It does fully fill in the xrange(2,3), but 
the border conditions xrange(1,2) and xrange(3,4) are not fully filled under 
the line.

I had the same problem with fill_over and was hoping it would be resolved with 
the move to fill_between. Any ideas?

-Ryan
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to