Skip to content

Instantly share code, notes, and snippets.

@ycopin
Created February 22, 2013 11:05
Show Gist options
  • Save ycopin/5012663 to your computer and use it in GitHub Desktop.
Save ycopin/5012663 to your computer and use it in GitHub Desktop.
Test script for matplotlib.basemap issues #100 and #101
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time-stamp: <2013-02-22 12:00:07 ycopin>
import numpy as N
import matplotlib.pyplot as P
from mpl_toolkits.basemap import Basemap
xs = N.linspace(0,30,5)
ys = N.linspace(20,50,5)
fig,(ax1,ax2,ax3) = P.subplots(3,1)
bmap1 = Basemap(ax=ax1, projection='moll', lon_0=0, lat_0=0, celestial=False)
bmap1.warpimage(scale=0.1) # Blue Marble
x1s,y1s = bmap1(xs, ys)
bmap1.plot(x1s, y1s, 'ro')
ax1.set_title("Mollweide, celestial=False")
bmap2 = Basemap(ax=ax2, projection='hammer', lon_0=0, lat_0=0, celestial=False)
bmap2.warpimage(scale=0.1) # Blue Marble
x2s,y2s = bmap2(xs, ys)
bmap2.plot(x2s, y2s, 'ro')
ax2.set_title("Hammer, celestial=False")
bmap3 = Basemap(ax=ax3, projection='hammer', lon_0=0, lat_0=0, celestial=True)
bmap3.warpimage(scale=0.1) # Blue Marble
x3s,y3s = bmap3(xs, ys)
bmap3.plot(x3s, y3s, 'ro')
ax3.set_title("Hammer, celestial=True")
P.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment