Geoplots Examples: Create a Basemap

  • Wenchang Yang
  • yang.wenchang@uci.edu

In [1]:
!date


Mon May  8 10:19:57 PDT 2017

In [2]:
import matplotlib.pyplot as plt
from geoplots import geoplot
import xarray as xr
%matplotlib inline
plt.rc('figure', figsize=(8,5))

Create a basemap without any args or kwargs

The default projection is "hammer" from the basemap package. Coastlines and grid lines are also plotted.


In [3]:
geoplot()


Out[3]:
<mpl_toolkits.basemap.Basemap at 0x7f3fed9d1d30>

Try different projections


In [4]:
geoplot(proj='robin')


Out[4]:
<mpl_toolkits.basemap.Basemap at 0x7f3fecfbe4e0>

In [5]:
geoplot(proj='ortho')


Out[5]:
<mpl_toolkits.basemap.Basemap at 0x7f3fecdf5860>

In [6]:
geoplot(proj='npolar')


Out[6]:
<mpl_toolkits.basemap.Basemap at 0x7f3fecc82278>

In [7]:
geoplot(proj='spolar')


Out[7]:
<mpl_toolkits.basemap.Basemap at 0x7f3fecbf0518>

In [8]:
geoplot(proj='lcc')


Out[8]:
<mpl_toolkits.basemap.Basemap at 0x7f3fbc5d00b8>

Try different map centers


In [9]:
geoplot(lon_0=180)


Out[9]:
<mpl_toolkits.basemap.Basemap at 0x7f3fbc4ddc88>

In [10]:
geoplot(proj='ortho', lon_0=120, lat_0=60)


Out[10]:
<mpl_toolkits.basemap.Basemap at 0x7f3fbc2d79e8>

Fill continents and/or oceans


In [11]:
geoplot(land_on=True)


Out[11]:
<mpl_toolkits.basemap.Basemap at 0x7f3fbc1015c0>

In [12]:
geoplot(land_on=True, land_color='coral')


Out[12]:
<mpl_toolkits.basemap.Basemap at 0x7f3fbc5c3c88>

In [13]:
geoplot(land_on=True, land_color='coral', ocean_on=True)


Out[13]:
<mpl_toolkits.basemap.Basemap at 0x7f3fb4354240>

Add grid labels


In [14]:
geoplot(grid_label_on=True)


Out[14]:
<mpl_toolkits.basemap.Basemap at 0x7f3fb405aba8>

In [15]:
geoplot(proj='robin', grid_label_on=True, meridian_kw={'rotation':-30})


Out[15]:
<mpl_toolkits.basemap.Basemap at 0x7f3fafeb87f0>

In [16]:
geoplot(proj='npolar', grid_label_on=True)


Out[16]:
<mpl_toolkits.basemap.Basemap at 0x7f3fafcb27b8>