Re: [matplotlib-devel] AutoDateFormatter/AutoDateLocator

2009-10-16 Thread Ryan May
On Wed, Oct 14, 2009 at 3:59 PM, John Hunter jdh2...@gmail.com wrote:
 I don't have a strong opinion on this -- making it more customizable
 is a good thing -- this came up at scipy as well, where I contributed
 a patch to make the AutoDateFormatter a little more customizable by
 exposing a scaled dictionary mapping the scale to a format string.  As
 long as the extension to the AutoDateLocator preserves the core
 functionality, I say have at it.

Here's a patch that implements the ideas I have.  To the best of my
ability, it preserves the same behavior as before, it just opens it up
to configuration by the user instead of being hard-coded. It adds:

1) Configuring the minimum number of ticks, which determines whether
to do yearly, monthly, etc. ticking

2) Configuring the maximum number of ticks, which is used to select
what interval of ticking to use.  This is actually
done on a per-frequency basis.  This helps to keep in line with
previous behavior and is useful for keeping tick spacing in line with
what the label would be for a given frequency.  The user can also
simply pass an integer that
gives the maximum for all frequencies.

3) A dictionary of intervals corresponding to each frequency.  This
keeps the previous functionality of appropriate intervals for each
frequency, but also opens it up to user configuration.

4) Optional ticking on multiples of the interval.  Previously, if you
were ticking with, say, 10 minute intervals, and the range happened to
start at 33 minutes, you'd get ticks at 33, 43, 53, etc.  With this
flag set, the ticks instead end up at 40, 50, 0, 10, etc.

I'd appreciate anyone looking this over for any glaring problems
before I check this in.  I've done my best to preserve old
functionality, though I'm still working on getting the unit tests to
run here.  It also passes my own testing here when I fiddle with the
new knobs that have been exposed.  My one question is: how important
is keeping API compatibility?  The constructor tries to follow the
convention of the rest of the module (tz is last or nearly so), but
this breaks compatibility (where tz was the only argument).  Also, to
me, it would be nice to tick multiples of the interval by default.

Thoughts?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States


autodatelocator.diff
Description: Binary data
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] AutoDateFormatter/AutoDateLocator

2009-10-16 Thread Ryan May
[Putting this back on devel]

 Have you checked scikits.timeseries.lib.plotlib ? We provide some functions
 that adapt the ticks to the frequency of you base series, but also according
 to the range of the axes. For example, if you work with a 100-y daily
 timeseries, you'll have major ticks every 5 years if you plot the whole
 series, every month if you plot or zoom on one year only, etc.
 it may be worthwhile to give it a try. I'd be happy to help adapting our
 code to remove the dependency on scikits.timeseries if needed...

No, I hadn't seen this.  And argh!, I wish I had *before* I had coded
up something that met my needs.  I hate to see a duplication of effort
and would love to see more of your matplotlib extensions moved into
matplotlib itself.  Having said that, I now have a patch that
accomplishes what I want and (now) keeps our unit tests passing. I've
also pretty much expended all the time I have for matplotlib
development in the short term.  So if one of the other devs is
interested, awesome.  But for me at this point, I can't go study yet
more code when I have something IMO ready to check in.

Ryan

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

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] AutoDateFormatter/AutoDateLocator

2009-10-14 Thread John Hunter
On Wed, Oct 14, 2009 at 2:16 PM, Ryan May rma...@gmail.com wrote:
 Hi,

 Anybody know what the status of AutoDateLocator/AutoDateFormatter in
 matplotlib.dates are?  They work and seem reasonably well documented.
 However, they do not show up in our online docs:

 http://matplotlib.sourceforge.net/api/dates_api.html

 They show up in the inheritance graph, but are not mentioned elsewhere
 in the page and in fact have no link from the image.  They're also not
 present in the __all__ in the dates module.  If this is just an
 oversight, what do I need to do to make the classes show up in the
 docs?

Most likely this is just due to an oversight in the __all__ so just
add it there in the branch and it should get picked up next time we
build the docs

JDH

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] AutoDateFormatter/AutoDateLocator

2009-10-14 Thread Ryan May
On Wed, Oct 14, 2009 at 3:08 PM, John Hunter jdh2...@gmail.com wrote:
 Most likely this is just due to an oversight in the __all__ so just
 add it there in the branch and it should get picked up next time we
 build the docs

Done.  I also added them to the module-level docstring.

Along these lines, I was trying to make use of AutoDateLocator, and as
far as I can tell, there's no way to customize its behavior right now.
 So when trying to use this for doing major and minor ticks, there's
no difference.  It looks like in the get_locator() method of
AutoDateLocator, numticks is used to control what types of ticking
(yearly, monthly) is used.  Would it make sense to have this as an
attribute of self so that the user can tweak it?  Or maybe go to:

1) minticks (instead of numticks) which specifies a minimum number of
ticks that are desired,
 to select yearly, monthly, etc.
2) maxticks, which specifies a maximum number of ticks, which can be
used to calculate the interval
 (every N'th month). Right now, the rules for selecting this are hard coded.

I'm interested in hacking this up.  But since you wrote the code, I
want to make sure that going this direction makes sense to you.

Ryan

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

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] AutoDateFormatter/AutoDateLocator

2009-10-14 Thread John Hunter
On Wed, Oct 14, 2009 at 3:47 PM, Ryan May rma...@gmail.com wrote:
 On Wed, Oct 14, 2009 at 3:08 PM, John Hunter jdh2...@gmail.com wrote:
 Most likely this is just due to an oversight in the __all__ so just
 add it there in the branch and it should get picked up next time we
 build the docs

 Done.  I also added them to the module-level docstring.

 Along these lines, I was trying to make use of AutoDateLocator, and as
 far as I can tell, there's no way to customize its behavior right now.
  So when trying to use this for doing major and minor ticks, there's
 no difference.  It looks like in the get_locator() method of
 AutoDateLocator, numticks is used to control what types of ticking
 (yearly, monthly) is used.  Would it make sense to have this as an
 attribute of self so that the user can tweak it?  Or maybe go to:

 1) minticks (instead of numticks) which specifies a minimum number of
 ticks that are desired,
     to select yearly, monthly, etc.
 2) maxticks, which specifies a maximum number of ticks, which can be
 used to calculate the interval
     (every N'th month). Right now, the rules for selecting this are hard 
 coded.

 I'm interested in hacking this up.  But since you wrote the code, I
 want to make sure that going this direction makes sense to you.

I don't have a strong opinion on this -- making it more customizable
is a good thing -- this came up at scipy as well, where I contributed
a patch to make the AutoDateFormatter a little more customizable by
exposing a scaled dictionary mapping the scale to a format string.  As
long as the extension to the AutoDateLocator preserves the core
functionality, I say have at it.

JDH

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel