On Fri, May 15, 2009 at 4:23 PM, Christopher Barker
<chris.bar...@noaa.gov> wrote:
> Sandro Tosi wrote:
>>>
>>> mpl.ticker.AutoDateLocator
>>> mpl.ticker.AutoDateFormatter
>>>
>>> Where might I find these now? They don't seem to be in matplotlib.ticker
>>> or matplotlib.date. do they have a new name? Is there a new way to get
>>> automatic date tic location and formating?
>
>> dates.AutoDateFormatter  dates.AutoDateLocator
>
> thanks -- I did just find it myself, by looking at the code in
> axes.plot_dates -- however, the plot_dates docstring is wrong, and they
> don't seem to be here:

I updated the plot_dates docstring in svn to point to matplotlib.dates

> http://matplotlib.sourceforge.net/api/dates_api.html
>
> They are there in the diagram on top, but don't seem to be on the page.

That is odd -- any sphinx gurus have any idea why these are not being
picked up by the automodule code?

>>> note: I'm trying to do this for the x axis of a quiver plot, which
>>> doesn't seem to support passing in dates directly.
>
> by the way, is that a bug that should be tracked down and fixed?

Not all of the methods currently support direct date/unit plotting,
but we do try to extend support when we have reported failures, so if
you post a script which exposes the problem I'll try and fix it.

> However, in this case, I'm trying to write method that takes an axes object,
> and plots to that -- how can I do this without the figure reference?

Most mpl objects have a reference to their parent, so you can walk up
the containment hierarchy, eg

  line.axes.figure.canvas

so in your case

  ax.figure.autofmt_xdate()

but note that autofmt_xdate is designed to work for subplots with only
one column, not in the case of general axes configurations, so calling
this from an axes in a method that does not know how the axes are
layed out does not make sense.  But you can do the main part yourself

  for label in ax.get_xticklabels():
      label.set_rotation(30)
      label.set_horizontalalignment('right')

> But it does work well if you apply it to the figure after my plotting
> routines.

That is the best place to apply it, because there you know the subplot
layout is suitable for the call.

JDH

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to