def create_simple_legend(self, skip_duplicates=True): ''' Wrapper around Pycane's legend creation function that uses configured legend position and alpha settings ''' pycane_bling.create_simple_legend(skip_duplicates=skip_duplicates, alpha=self.cfg.legend_alpha, position=self.cfg.legend_position)
tcv_plot_helper.plot_tcv_metric_vs_fhr( forecast_track, metric, y_label=yLabel, time_axis_parameter="epoch_zeta", label=label, color=colors[i]) #plt.legend() #plt.figure("maxwind_value") #plt.plot(maxwinds, color=colors[i], lw=line_width, label=label) #plt.legend() plt.figure("tracks") bling.decorate_map(m) # options worth testing: water_color='#99ffff',lake_color='#99ffff', #continent_color='#cc9966' # plot legend. The skip_duplicates arg must be True since the plot_track() # function actually plots multiple lines for each track in order to vary # the intensity of the color based on the max wind value bling.create_simple_legend(skip_duplicates=True, position='upper right') plt.savefig('tracks.png') plt.figure("mslp_value") plt.legend(loc='best') plt.savefig("mslp.png") plt.figure("maxwind_value") plt.legend(loc='best') plt.savefig("maxwind.png")
m = track_plotter.plot_track(lats, lons, windspeeds=maxwinds, indicator_freq=day_idc, line_color='black', ns_gridline_freq=10, we_gridline_freq=10, flagged_idc=flagged_idc, label = 'gfdl') # nolan (converted to diapost format) forecast_track = trkutils.get_diapost_track_data(hnr1_nolan_diapost) lons = [entry.lon for entry in forecast_track.tracker_entries] lats = [entry.lat for entry in forecast_track.tracker_entries] fhrs = [entry.fhr for entry in forecast_track.tracker_entries] maxwinds = [entry.maxwind_value for entry in forecast_track.tracker_entries] flagged = [entry.flagged for entry in forecast_track.tracker_entries] flagged_idc = [ i for i,v in enumerate(flagged) if v is True ] day_idc = [ idx for idx,val in enumerate(fhrs) if val%TIME_MARKER_INTERVAL == 0 ] track_plotter.plot_track(lats, lons, windspeeds=maxwinds, indicator_freq=day_idc, line_color='red', ns_gridline_freq=10, we_gridline_freq=10, line_style='--', flagged_idc=flagged_idc, basemap = m, label = 'nolan') bling.decorate_map(m) # options worth testing: water_color='#99ffff',lake_color='#99ffff', #continent_color='#cc9966' # plot legend. The skip_duplicates arg must be True since the plot_track() # function actually plots multiple lines for each track in order to vary # the intensity of the color based on the max wind value bling.create_simple_legend(skip_duplicates=True) plt.savefig('hnr1_tracks.png')