def wros(self, ws, wd, maxi=10, dev=None, date=None, base=None): '''Plot a wind rose given an array of wind speed and wind direction''' fig = plt.figure(figsize=(30, 30), dpi=150, facecolor='w', edgecolor='w') rect = [0.1, 0.1, 0.8, 0.8] ax = WindroseAxes(fig, rect, axisbg='w') fig.add_axes(ax, fontsize=12) try: ax.bar(wd, ws, normed=True, opening=1, edgecolor='white', bins=[0, 2, 6, 12, 20, 29, 39, 50]) ax.set_rmax(12) ax.set_radii_angle() l = ax.legend(loc=(1, 0)) if self.periods == None: if base != None and date != None: title = 'Wind rose at ' + str( self.height) + 'm and at ' + str( self.selected_cell[0]) + ' in ' + str( date) + ' during the ' + str( base) + ' by ' + str(dev) elif base != None: title = 'Wind rose at ' + str( self.height) + 'm and at ' + str( self.selected_cell[0]) + ' during the ' + str( base) + ' by ' + str(dev) elif date != None: title = 'Wind rose at ' + str( self.height) + 'm and at ' + str( self.selected_cell[0]) + ' in ' + str( date) + ' by ' + str(dev) else: title = 'Wind rose at ' + str( self.height) + 'm and at ' + str( self.selected_cell[0]) + ' by ' + str(dev) else: title = 'Wind statistics at ' + str( self.height) + 'm and at ' + str( self.selected_cell[0]) + str( self.periods) + ' by ' + str(dev) plt.setp(l.get_texts(), fontsize=12) plt.title(title, fontsize=12, y=1.07) plt.show() except ValueError: print 'No windrose for ' + str(dev)
WS, cmap=cm.viridis, normed=True, nsector=36, bins=np.arange(0, 14, 2)) #summer plt.text(-0.06, 1, '(a)', ha='left', va='center', transform=ax.transAxes, fontsize=bx_fs + 3) plt.tick_params(axis='x', which='major', labelsize=tk_fs + 3) ax.set_rlabel_position(340) #122, 344, 198, 340 ax.set_rmax(10) #8, 10 ax.set_rticks(np.arange(0, 11, 2)) ax.set_yticklabels(['', ' 2%', ' 4%', ' 6%', ' 8%', ' 10%'], fontsize=tk_fs) #ax.set_yticklabels(['','2%','4%','6%','8%','10%'], fontsize=tk_fs) rect = [0.52, 0, 0.5, 1] ax = WindroseAxes(fig, rect) fig.add_axes(ax) ax.bar(WD_b, WS_b, cmap=cm.viridis, normed=True, nsector=36, bins=np.arange(0, 14, 2)) #summer