pyplot.fill() and masked arrays

Hi,

Is there any reason pyplot.fill() doesn't support masked arrays? Or was it just overlooked?

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Ryan May wrote:

Hi,

Is there any reason pyplot.fill() doesn't support masked arrays? Or was it just overlooked?

I think the reason is that it is not obvious what any filled region with masked vertices should look like.

Eric

Ryan May wrote:

Hi,

Is there any reason pyplot.fill() doesn't support masked arrays? Or was it just overlooked?

Looks like this is better handled by fill_between, nevermind.

Now, what about dates? I'm having problems using dates for the x-axis for fill_between. I know I can use date2num on my array, but I was wonder if there was some magic I could add to the fill_between code.

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Ryan May wrote:

Ryan May wrote:

Hi,

Is there any reason pyplot.fill() doesn't support masked arrays? Or was it just overlooked?

Looks like this is better handled by fill_between, nevermind.

Now, what about dates? I'm having problems using dates for the x-axis for fill_between. I know I can use date2num on my array, but I was wonder if there was some magic I could add to the fill_between code.

Magic is the operative word. It is sprinkled like pixie dust throughout mpl. You may be able to figure it out by looking at the code for other functions that do support units. You could look for recent commits by Ted Drain, if I remember correctly, and by John, both of whom fill gaps in units handling every now and then.

For example, note this line at the top of scatter:

         self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)

Eric

···

Ryan

Eric Firing wrote:

Ryan May wrote:

Now, what about dates? I'm having problems using dates for the x-axis for fill_between. I know I can use date2num on my array, but I was wonder if there was some magic I could add to the fill_between code.

Magic is the operative word. It is sprinkled like pixie dust throughout mpl. You may be able to figure it out by looking at the code for other functions that do support units. You could look for recent commits by Ted Drain, if I remember correctly, and by John, both of whom fill gaps in units handling every now and then.

For example, note this line at the top of scatter:

        self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)

Well, combine all that pixie dust with a few wonderful thoughts, and we should all be flying like Peter Pan! :slight_smile:

Seriously, thanks for the pointer. _process_unit_info() combined with convert_[x|y]units() made it work. Old example and my own code here both work. Checked into r6497.

Thanks,

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma