climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From good...@apache.org
Subject svn commit: r1508574 - /incubator/climate/branches/RefactorInput/ocw/plotter.py
Date Tue, 30 Jul 2013 18:25:51 GMT
Author: goodman
Date: Tue Jul 30 18:25:51 2013
New Revision: 1508574

URL: http://svn.apache.org/r1508574
Log:
CLIMATE-231 - Implemented a method to manually add plotting functions and fixed a typo from
previous commit .

Modified:
    incubator/climate/branches/RefactorInput/ocw/plotter.py

Modified: incubator/climate/branches/RefactorInput/ocw/plotter.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/plotter.py?rev=1508574&r1=1508573&r2=1508574&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/plotter.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/plotter.py Tue Jul 30 18:25:51 2013
@@ -170,12 +170,21 @@ class Plotter:
                 logging.warning(warning)
                 continue
                 
-            self._plot_data.append((plotfunc, args, kwargs))
+            self.add_plot_func(plotfunc, *args, **kwargs)
+            
+    def add_plot_func(self, plotfunc, *args, **kwargs):
+        '''
+        Add a plotting function to the plotter with given positional and
+        keyword arguments.
         
+        :param plotfunc: Reference to a plotting function. 
+        :type plotfunc: function
+        '''
+        self._plot_data.append((plotfunc, args, kwargs))
+    
     def make_plots(self):
         '''
-        Calls the actual plotting functions, either defined in a separate module
-        (eg rcmes/toolkit/plots.py) or placed directly in this one. 
+        Calls the stored plotting functions
         '''
         if not self._plot_data:
             raise AttributeError('No compatible plotting functions found!')
@@ -482,9 +491,9 @@ def draw_time_series(datasets, times, la
         data = datasets[i]
         if label_month:
             xfmt = mpl.dates.DateFormatter('%b')
+            xloc = mpl.dates.MonthLocator()
             ax.xaxis.set_major_formatter(xfmt)
             ax.xaxis.set_major_locator(xloc)
-            ax.xaxis.set_major_formatter(xfmt)
     
         # Set the y-axis scale
         ax.set_yscale(yscale)



Mime
View raw message