| 
     
      
      
      From: Christopher B. <Chr...@no...> - 2009-05-15 19:28:44
       
   | 
Hey folks, IN old mailing list messages, I see reference to: 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? 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. Thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...  | 
| 
     
      
      
      From: Sandro T. <mo...@de...> - 2009-05-15 20:13:17
       
   | 
Hi Chris,
On Fri, May 15, 2009 at 21:29, Christopher Barker <Chr...@no...> wrote:
> Hey folks,
>
> IN old mailing list messages, I see reference to:
>
> 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?
In [14]: from matplotlib import dates
In [15]: dates.Au
dates.AutoDateFormatter  dates.AutoDateLocator
> 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.
simple snippet (with some additional formatting and stuff you might need):
In [13]: dateFmt = mpl.dates.DateFormatter('%Y-%m-%d')
In [14]: ax2.xaxis.set_major_formatter(dateFmt)
In [15]: daysLoc = mpl.dates.DayLocator()
In [16]: hoursLoc = mpl.dates.HourLocator(interval=6)
In [17]: ax2.xaxis.set_major_locator(daysLoc)
In [18]: ax2.xaxis.set_minor_locator(hoursLoc)
In [19]: fig.autofmt_xdate(bottom=0.18) # adjust for correct date labels display
In [20]: fig.subplots_adjust(left=0.18)
HTH
Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
 | 
| 
     
      
      
      From: Christopher B. <Chr...@no...> - 2009-05-15 21:22:23
       
  
        
          
            Attachments:
            StickPlot.py
          
        
       
     | 
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: 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. >> 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? > simple snippet (with some additional formatting and stuff you might need): thanks. In this case, I'm writing plotting code that I want to work with time series that may span hours, or days, or weeks, or months, ... hence by desire for Auto Formatting. It does work, but not all that well, though: > In [19]: fig.autofmt_xdate(bottom=0.18) # adjust for correct date labels display Thanks, this one helps a lot.0 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? But it does work well if you apply it to the figure after my plotting routines. see enclosed for what I'm doing -- this is for plotting wind data and the like, where you have a time series of speeds and directions. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...  | 
| 
     
      
      
      From: John H. <jd...@gm...> - 2009-05-16 12:58:32
       
   | 
On Fri, May 15, 2009 at 4:23 PM, Christopher Barker <Chr...@no...> 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  | 
| 
     
      
      
      From: Christopher B. <Chr...@no...> - 2009-05-18 19:34:13
       
  
        
          
            Attachments:
            quiver_date_test.py
          
        
       
     | 
John Hunter wrote: > <Chr...@no...> wrote: > I updated the plot_dates docstring in svn to point to matplotlib.dates great, thanks! > 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. OK. Enclosed. If you uncomment the "date2num" call, it works fine, but it crashes as it is. Thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...  |