Python matplotlib.cm.nipy_spectral() Examples
The following are 1
code examples of matplotlib.cm.nipy_spectral().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.cm
, or try the search function
.
Example #1
Source File: cfplot.py From cfanalytics with BSD 3-Clause "New" or "Revised" License | 4 votes |
def _plot_city(self, ds): """Plot the results of gyms in a city. Parameters ---------- self.ds_sorted : xr.Dataset xr.Dataset with Coordinates: gyms. Returns ------- matplotlib.pyplot.figure : matplotlib.pyplot.figure Creates city plot. """ # Create extend of map [W, E, S, N] extent = [ds['longitude'].values.min(), ds['longitude'].values.max(), ds['latitude'].values.min(), ds['latitude'].values.max()] # Setup colors colors = cm.nipy_spectral(np.linspace(0,1,len(ds['gyms']))) # Get google map. Scale is for more details. Mapytype can have # 'terrain' or 'satellite' g = GoogleVisibleMap(x=[extent[0], extent[1]], y=[extent[2], extent[3]], scale=4, maptype='terrain') ggl_img = g.get_vardata() # Plot map fig, ax = plt.subplots(1, 1, figsize=(20,20)) sm = Map(g.grid, factor=1, countries=False) sm.set_rgb(ggl_img) sm.visualize(ax=ax) # Plot gym points for i in range(0, len(ds['gyms'])): # Create label self.regcount = i self._rank() # Add self.rank _label = self.rank+' '+ds['gyms'].values[i]+': '+\ ds['athlete_names'].values[i]+' ('+str(ds[self.how].values[i])+')' x, y = sm.grid.transform(ds['longitude'].values[i], ds['latitude'].values[i]) ax.scatter(x, y, color=colors[i], s=400, label=_label) plt.title(self.fname+' | '+self.city+' | '+self.column+' | '+self.how) # Shrink current axis by 20% to make room for legend box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) plt.savefig(self.plotdir+self.fname+'_'+self.city+'_'+self.column+'_'+\ self.how+'.png', bbox_inches = 'tight') #plt.savefig(self.plotdir+self.fname+'_'+self.city+'_'+self.column+\ # self.how+'.png', bbox_inches = 'tight', format='eps') plt.show()