Guest User

Untitled

a guest
Apr 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. def plotMap():
  2.  
  3. proj = ccrs.Mercator(central_longitude=180, min_latitude=15,
  4. max_latitude=55)
  5.  
  6. fig, ax = plt.subplots(subplot_kw=dict(projection=proj), figsize=(12,12))
  7.  
  8. ax.set_extent([255 ,115, 0, 60], crs=ccrs.PlateCarree())
  9.  
  10. ax.add_feature(cfeature.LAND, facecolor='0.3')
  11. ax.add_feature(cfeature.LAKES, alpha=0.9)
  12. ax.add_feature(cfeature.BORDERS, zorder=10)
  13. ax.add_feature(cfeature.COASTLINE, zorder=10)
  14.  
  15.  
  16. #(http://www.naturalearthdata.com/features/)
  17. states_provinces = cfeature.NaturalEarthFeature(
  18. category='cultural', name='admin_1_states_provinces_lines',
  19. scale='50m', facecolor='none')
  20. ax.add_feature(states_provinces, edgecolor='black', zorder=10)
  21.  
  22. #ax.gridlines(xlocs=grids_ma, ylocs=np.arange(-80,90,20), zorder=21,
  23. draw_labels=True )
  24. ax.gridlines(crs=ccrs.PlateCarree(), linewidth=2, color='black',
  25. draw_labels=True, alpha=0.5, linestyle='--')
  26. ax.xlabels_top = False
  27. ax.ylabels_left = False
  28. ax.ylabels_right=True
  29. ax.xlines = True
  30. ax.xlocator = mticker.FixedLocator([-160, -140, -120, 120, 140, 160, 180,])
  31. ax.xformatter = LONGITUDE_FORMATTER
  32. ax.yformatter = LATITUDE_FORMATTER
  33. ax.xlabel_style = {'size': 15, 'color': 'gray'}
  34. ax.xlabel_style = {'color': 'red', 'weight': 'bold'}
  35.  
  36.  
  37. return fig, ax
Add Comment
Please, Sign In to add comment