Skip to content

Instantly share code, notes, and snippets.

@pmarshwx
Created August 19, 2012 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmarshwx/3397206 to your computer and use it in GitHub Desktop.
Save pmarshwx/3397206 to your computer and use it in GitHub Desktop.
Simple script to test the latlon keword argument added to plot
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
def draw_map_background(m, ax):
ax.set_axis_bgcolor('#729FCF')
m.fillcontinents(color='#FAFAFA', ax=ax, zorder=0)
m.drawstates(ax=ax)
m.drawcountries(ax=ax)
m.drawcoastlines(ax=ax)
KM = 1000.
clat = 39.3
clon = -94.7333
wid = 5500 * KM
hgt = 3500 * KM
m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,lon_0=0,
llcrnrlon=-180,urcrnrlon=180,resolution='i', area_thresh=2500)
fig = plt.figure()
ax = fig.add_subplot(111)
clons = range(0, 361, 5)
clats = [i/4. for i in clons]
nclats = [-i for i in clats]
draw_map_background(m, ax)
m.plot(270, clat, 'go', latlon=True, ax=ax)
m.plot(clons, clats, 'r', latlon=True)
m.plot(clons, nclats, 'r', latlon=True)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment