Axes.xaxis_date(), yaxis_date() proposal

Hi John, I've been making spacecraft trajectory "Pork

    > Chop Plots", a contour plot of a z-value (such amount of
    > fuel required) over a range of Earth departure date
    > x-values and Mars arrival date y-values.

    > Since I needed dates on both x and y axes, it was useful
    > for me to factor out the date locator/formatter selection
    > code from plot_date() into two Axes methods: xaxis_date()
    > and yaxis_date().

    > The plot_date() implementation then becomes just a call
    > to plot() followed by a call to xaxis_date().

I think this is a good idea. A few suggestions

matplotlib 0.84 / CVS already has the guts of plot_date factored out
in date_ticker_factory

  locator, formatter = date_ticker_factory(span, tz)

which appears to be the same thing as your chooseDateFmt. So you'll
want to use that instead. Note also that matplotlib naming
conventions for functions and methods is lower case and underscore
separated.

I think it would be useful to add the following kwargs to plot_date to
support your funcitonality

    def plot_date(self, d, y, fmt='bo', tz=None,
                  xdate=True, ydate=False, **kwargs):

    > My current implementation is below. Is this
    > general-purpose enough for me to submit? If so, I'll
    > make up some diff files and mail them in.

Yep, with the changes above this would be great.

Thanks!
JDH

Hi John,

Attached is the Axes.xaxis_date(), yaxis_date() patch.

I implemented the suggestions you made, including the extra keyword args to plot_date().

I was happy to see the date_ticker_factory() function was so similar to what I'd implemented on my own. Great minds think alike, I guess.

Cheers,

Michael

axes.py.patch (3.8 KB)

···

On Mon, 3 Oct 2005, John Hunter wrote:

"Michael" writes:

   > Hi John, I've been making spacecraft trajectory "Pork
   > Chop Plots", a contour plot of a z-value (such amount of
   > fuel required) over a range of Earth departure date
   > x-values and Mars arrival date y-values.

   > Since I needed dates on both x and y axes, it was useful
   > for me to factor out the date locator/formatter selection
   > code from plot_date() into two Axes methods: xaxis_date()
   > and yaxis_date().

   > The plot_date() implementation then becomes just a call
   > to plot() followed by a call to xaxis_date().

I think this is a good idea. A few suggestions

matplotlib 0.84 / CVS already has the guts of plot_date factored out
in date_ticker_factory

locator, formatter = date_ticker_factory(span, tz)

which appears to be the same thing as your chooseDateFmt. So you'll
want to use that instead. Note also that matplotlib naming
conventions for functions and methods is lower case and underscore
separated.

I think it would be useful to add the following kwargs to plot_date to
support your funcitonality

   def plot_date(self, d, y, fmt='bo', tz=None,
                 xdate=True, ydate=False, **kwargs):

   > My current implementation is below. Is this
   > general-purpose enough for me to submit? If so, I'll
   > make up some diff files and mail them in.

Yep, with the changes above this would be great.

Thanks!
JDH

--

  Michael Brady Phone: 818-354-4957
  Jet Propulsion Laboratory (M/S 301-140L)
  4800 Oak Grove Drive
  Pasadena, CA 91109