Improved labels in colorplots

Fri, 13 Dec 2013 11:41:07 +0100

author
ulalume3 <binietoglou@imaa.cnr.it>
date
Fri, 13 Dec 2013 11:41:07 +0100
changeset 19
4dfa28236785
parent 18
6c7505d70090
child 20
18a77f8065c1

Improved labels in colorplots

generic.py file | annotate | diff | comparison | revisions
--- a/generic.py	Fri Dec 13 11:40:25 2013 +0100
+++ b/generic.py	Fri Dec 13 11:41:07 2013 +0100
@@ -526,7 +526,7 @@
         #dayFormatter = mpl.dates.DateFormatter('\n\n%d/%m')
         #daylocator = mpl.dates.DayLocator()       
         hourFormatter = mpl.dates.DateFormatter('%H:%M')
-        hourlocator = mpl.dates.AutoDateLocator(interval_multiples=True)
+        hourlocator = mpl.dates.AutoDateLocator(minticks = 3, maxticks = 8, interval_multiples=True)
 
         
         #ax1.axes.xaxis.set_major_formatter(dayFormatter)
@@ -552,6 +552,12 @@
         
         cb1 = plt.colorbar(im1)
         cb1.ax.set_ylabel(cmap_label)
+        
+        # Make the ticks of the colorbar smaller, two points smaller than the default font size
+        cb_font_size = mpl.rcParams['font.size'] - 2
+        for ticklabels in cb1.ax.get_yticklabels():
+            ticklabels.set_fontsize(cb_font_size)
+        cb1.ax.yaxis.get_offset_text().set_fontsize(cb_font_size)
 
     def index_at_height(self, height):
         idx = np.array(np.abs(self.z - height).argmin())

mercurial