# HG changeset patch # User ulalume3 # Date 1386931267 -3600 # Node ID 4dfa28236785ce1d1ead7dd6ebfe7ce8130a5e09 # Parent 6c7505d70090298066c351665d980fb7fdf71cea Improved labels in colorplots diff -r 6c7505d70090 -r 4dfa28236785 generic.py --- 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())