diff --git a/doc/conf.py b/doc/conf.py index 3aaa1947b..9dce4e348 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -23,12 +23,13 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc'] +extensions = ['sphinx.ext.autodoc', #extensions = ['matplotlib.sphinxext.mathmpl', # 'sphinx.ext.autodoc', 'matplotlib.sphinxext.only_directives', -# 'matplotlib.sphinxext.plot_directive', + 'matplotlib.sphinxext.plot_directive', # 'sphinx.ext.inheritance_diagram', -# 'matplotlib.sphinxext.ipython_console_highlighting'] +# 'matplotlib.sphinxext.ipython_console_highlighting', + ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -164,3 +165,14 @@ # Show both class-level docstring and __init__ docstring in class # documentation autoclass_content = 'both' + + + + +################ plot directive configurations ##################### +plot_html_show_formats = False +plot_include_source = True +plot_rcparams = {'figure.figsize':[8, 6]} +plot_formats = [('png', 100), # pngs for html building + ('pdf', 72), # pdfs for latex building + ] diff --git a/doc/make.py b/doc/make.py index 37ad8db0b..17bda9901 100755 --- a/doc/make.py +++ b/doc/make.py @@ -5,26 +5,10 @@ import shutil import sys -def check_build(): - build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex', - '_static', '_templates'] - for d in build_dirs: - try: - os.mkdir(d) - except OSError: - pass - -def figs(): - os.system('cd users/figures/ && python make.py') - def html(): - check_build() - figs() os.system('sphinx-build -b html -d build/doctrees . build/html') def latex(): - check_build() - figs() if sys.platform != 'win32': # LaTeX format. os.system('sphinx-build -b latex -d build/doctrees . build/latex') @@ -47,12 +31,11 @@ def clean(): shutil.rmtree('build') def all(): - figs() html() latex() -funcd = {'figs':figs, +funcd = { 'html':html, 'latex':latex, 'clean':clean, diff --git a/doc/users/aea.rst b/doc/users/aea.rst index 45ef85b46..d56235f96 100644 --- a/doc/users/aea.rst +++ b/doc/users/aea.rst @@ -12,6 +12,5 @@ shape is not. Distortion is very large near the poles in this projection. -.. literalinclude:: figures/aea.py -.. image:: figures/aea.png +.. plot:: users/figures/aea.py diff --git a/doc/users/aeqd.rst b/doc/users/aeqd.rst index 15ded0158..e81e6cf82 100644 --- a/doc/users/aeqd.rst +++ b/doc/users/aeqd.rst @@ -12,13 +12,9 @@ The specified point ``lon_0, lat_0`` shows up as a black dot in the center of th Here's an example using the width and height keywords to specify the map region. -.. literalinclude:: figures/aeqd.py - -.. image:: figures/aeqd.png +.. plot:: users/figures/aeqd.py If both the width/height and corner lat/lon keywords are omitted, the whole world is plotted in a circle. -.. literalinclude:: figures/aeqd_fulldisk.py - -.. image:: figures/aeqd_fulldisk.png +.. plot:: users/figures/aeqd_fulldisk.py diff --git a/doc/users/cass.rst b/doc/users/cass.rst index c4f4625a9..d2a7f2ed0 100644 --- a/doc/users/cass.rst +++ b/doc/users/cass.rst @@ -7,6 +7,4 @@ The transverse aspect of the equidistant cassindrical projection. The globe is first rotated so the central meridian becomes the "equator", and then the normal equidistant cylindrical projection is applied. -.. literalinclude:: figures/cass.py - -.. image:: figures/cass.png +.. plot:: users/figures/cass.py diff --git a/doc/users/cyl.rst b/doc/users/cyl.rst index da339ae9d..b1b7484ec 100644 --- a/doc/users/cyl.rst +++ b/doc/users/cyl.rst @@ -5,6 +5,4 @@ Equidistant Cylindrical Projection The simplest projection, just displays the world in latitude/longitude coordinates. -.. literalinclude:: figures/cyl.py - -.. image:: figures/cyl.png +.. plot:: users/figures/cyl.py diff --git a/doc/users/eck4.rst b/doc/users/eck4.rst index 932dec8f4..ce37e36e5 100644 --- a/doc/users/eck4.rst +++ b/doc/users/eck4.rst @@ -5,6 +5,4 @@ Eckert IV Projection A global equal-area projection. -.. literalinclude:: figures/eck4.py - -.. image:: figures/eck4.png +.. plot:: users/figures/eck4.py diff --git a/doc/users/eqdc.rst b/doc/users/eqdc.rst index fc1b66b3f..bb42e2563 100644 --- a/doc/users/eqdc.rst +++ b/doc/users/eqdc.rst @@ -11,6 +11,4 @@ On a conformal projection, the shape of the circles is preserved, but the area is not. On a equal-area projection, the area is preserved but the shape is not. -.. literalinclude:: figures/eqdc.py - -.. image:: figures/eqdc.png +.. plot:: users/figures/eqdc.py diff --git a/doc/users/examples.rst b/doc/users/examples.rst index 3921eb0b1..770658c57 100644 --- a/doc/users/examples.rst +++ b/doc/users/examples.rst @@ -37,65 +37,41 @@ to retrieve datasets over http): * Plot contour lines on a basemap -.. literalinclude:: figures/contour1.py - -.. image:: figures/contour1.png +.. plot:: users/figures/contour1.py * Plot precip with filled contours -.. literalinclude:: figures/plotprecip.py - -.. image:: figures/plotprecip.png +.. plot:: users/figures/plotprecip.py * Plot sea-level pressure weather map with labelled highs and lows -.. literalinclude:: figures/plothighsandlows.py +.. plot:: users/figures/plothighsandlows.py -.. image:: figures/plothighsandlows.png - * Plot hurricane tracks from a shapefile -.. literalinclude:: figures/hurrtracks.py +.. plot:: users/figures/hurrtracks.py -.. image:: figures/hurrtracks.png - * Plot etopo5 topography/bathymetry data as an image (with and without shading from a specified light source). -.. literalinclude:: figures/plotetopo5.py +.. plot:: users/figures/plotetopo5.py -.. image:: figures/etopo5.png - -.. image:: figures/etopo5_shaded.png - * Plot markers at locations of `ARGO `__ floats. -.. literalinclude:: figures/plotargo.py +.. plot:: users/figures/plotargo.py -.. image:: figures/plotargo.png - * Pseudo-color plot of SST and sea ice analysis. -.. literalinclude:: figures/plotsst.py +.. plot:: users/figures/plotsst.py -.. image:: figures/plotsst.png - * Plotting wind vectors and wind barbs. -.. literalinclude:: figures/plotwindvec.py +.. plot:: users/figures/plotwindvec.py -.. image:: figures/plotwindvec1.png - -.. image:: figures/plotwindvec2.png - * Draw great circle between NY and London. -.. literalinclude:: figures/plotgreatcircle.py +.. plot:: users/figures/plotgreatcircle.py -.. image:: figures/plotgreatcircle.png - * Draw day-night terminator on a map. -.. literalinclude:: figures/plotdaynight.py - -.. image:: figures/plotdaynight.png +.. plot:: users/figures/plotdaynight.py \ No newline at end of file diff --git a/doc/users/figures/aea.py b/doc/users/figures/aea.py index bb02fd40e..b7d43328d 100644 --- a/doc/users/figures/aea.py +++ b/doc/users/figures/aea.py @@ -23,4 +23,4 @@ poly = m.tissot(lon,lat,1.25,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("Albers Equal Area Projection") -plt.savefig('aea.png') +plt.show() diff --git a/doc/users/figures/aeqd.py b/doc/users/figures/aeqd.py index c97be3126..feea390a6 100644 --- a/doc/users/figures/aeqd.py +++ b/doc/users/figures/aeqd.py @@ -17,4 +17,4 @@ m.plot([xpt],[ypt],'ko') # draw the title. plt.title('Azimuthal Equidistant Projection') -plt.savefig('aeqd.png') +plt.show() diff --git a/doc/users/figures/aeqd_fulldisk.py b/doc/users/figures/aeqd_fulldisk.py index 9e4fd5f30..51b5c1280 100644 --- a/doc/users/figures/aeqd_fulldisk.py +++ b/doc/users/figures/aeqd_fulldisk.py @@ -16,4 +16,4 @@ m.plot([xpt],[ypt],'ko') # draw the title. plt.title('Whole World Azimuthal Equidistant Projection') -plt.savefig('aeqd_fulldisk.png') +plt.show() diff --git a/doc/users/figures/azeqd.py b/doc/users/figures/azeqd.py index 1e37b5d14..feea390a6 100644 --- a/doc/users/figures/azeqd.py +++ b/doc/users/figures/azeqd.py @@ -17,4 +17,4 @@ m.plot([xpt],[ypt],'ko') # draw the title. plt.title('Azimuthal Equidistant Projection') -plt.savefig('azeqd.png') +plt.show() diff --git a/doc/users/figures/background1.py b/doc/users/figures/background1.py index 8e1ea4897..fe5174f2d 100644 --- a/doc/users/figures/background1.py +++ b/doc/users/figures/background1.py @@ -11,4 +11,4 @@ m.drawmapboundary(fill_color='aqua') # fill continents, set lake color same as ocean color. m.fillcontinents(color='coral',lake_color='aqua') -plt.savefig('background1.png') +plt.show() diff --git a/doc/users/figures/background2.py b/doc/users/figures/background2.py index a56782c92..b0fe4dd57 100644 --- a/doc/users/figures/background2.py +++ b/doc/users/figures/background2.py @@ -8,4 +8,4 @@ # lakes=True means plot inland lakes with ocean color. m.drawlsmask(land_color='coral',ocean_color='aqua',lakes=True) plt.show() -plt.savefig('background2.png') +plt.show() diff --git a/doc/users/figures/background3.py b/doc/users/figures/background3.py index ac6e7548f..c84114410 100644 --- a/doc/users/figures/background3.py +++ b/doc/users/figures/background3.py @@ -5,4 +5,4 @@ m = Basemap(width=12000000,height=9000000,projection='lcc', resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) m.bluemarble() -plt.savefig('background3.png') +plt.show() diff --git a/doc/users/figures/background4.py b/doc/users/figures/background4.py index 3c420f346..e3db369b4 100644 --- a/doc/users/figures/background4.py +++ b/doc/users/figures/background4.py @@ -5,4 +5,4 @@ m = Basemap(width=12000000,height=9000000,projection='lcc', resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) m.shadedrelief() -plt.savefig('background4.png') +plt.show() diff --git a/doc/users/figures/background5.py b/doc/users/figures/background5.py index 112c9a141..edb413489 100644 --- a/doc/users/figures/background5.py +++ b/doc/users/figures/background5.py @@ -5,4 +5,4 @@ m = Basemap(width=12000000,height=9000000,projection='lcc', resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) m.etopo() -plt.savefig('background5.png') +plt.show() diff --git a/doc/users/figures/cass.py b/doc/users/figures/cass.py index 7e8bbf760..b9cd3b32a 100644 --- a/doc/users/figures/cass.py +++ b/doc/users/figures/cass.py @@ -19,4 +19,4 @@ m.drawmeridians(np.arange(-20.,21.,2.)) m.drawmapboundary(fill_color='aqua') plt.title("Cassini Projection") -plt.savefig('cass.png') +plt.show() diff --git a/doc/users/figures/contour1.py b/doc/users/figures/contour1.py index dea5104a0..64587b4c2 100644 --- a/doc/users/figures/contour1.py +++ b/doc/users/figures/contour1.py @@ -25,4 +25,4 @@ # contour data over the map. cs = map.contour(x,y,wave+mean,15,linewidths=1.5) plt.title('contour lines over filled continent background') -plt.savefig('contour1.png') +plt.show() diff --git a/doc/users/figures/cyl.py b/doc/users/figures/cyl.py index aac3678ce..8a80a6d53 100644 --- a/doc/users/figures/cyl.py +++ b/doc/users/figures/cyl.py @@ -14,4 +14,4 @@ m.drawmeridians(np.arange(-180.,181.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Equidistant Cylindrical Projection") -plt.savefig('cyl.png') +plt.show() diff --git a/doc/users/figures/eck4.py b/doc/users/figures/eck4.py index ceea603e6..711067802 100644 --- a/doc/users/figures/eck4.py +++ b/doc/users/figures/eck4.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Eckert IV Projection") -plt.savefig('eck4.png') +plt.show() diff --git a/doc/users/figures/eqdc.py b/doc/users/figures/eqdc.py index 24ecbe4ee..266aca3da 100644 --- a/doc/users/figures/eqdc.py +++ b/doc/users/figures/eqdc.py @@ -22,4 +22,4 @@ poly = m.tissot(lon,lat,1.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("Equidistant Conic Projection") -plt.savefig('eqdc.png') +plt.show() diff --git a/doc/users/figures/gall.py b/doc/users/figures/gall.py index 235803b99..6979ed1d3 100644 --- a/doc/users/figures/gall.py +++ b/doc/users/figures/gall.py @@ -14,4 +14,4 @@ m.drawmeridians(np.arange(-180.,181.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Gall Stereographic Projection") -plt.savefig('gall.png') +plt.show() diff --git a/doc/users/figures/geos_full.py b/doc/users/figures/geos_full.py index c1e668d8d..1ccf6cfba 100644 --- a/doc/users/figures/geos_full.py +++ b/doc/users/figures/geos_full.py @@ -13,4 +13,4 @@ m.drawmeridians(np.arange(0.,420.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Full Disk Geostationary Projection") -plt.savefig('geos_full.png') +plt.show() diff --git a/doc/users/figures/geos_partial.py b/doc/users/figures/geos_partial.py index 0a5464ab4..51f9e57f5 100644 --- a/doc/users/figures/geos_partial.py +++ b/doc/users/figures/geos_partial.py @@ -25,4 +25,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary() plt.title('Geostationary Map Showing A Quadrant of the Globe') -plt.savefig('geos_partial.png') +plt.show() diff --git a/doc/users/figures/gnomon.py b/doc/users/figures/gnomon.py index 27cc81519..883b90194 100644 --- a/doc/users/figures/gnomon.py +++ b/doc/users/figures/gnomon.py @@ -9,4 +9,4 @@ m.drawparallels(np.arange(10,90,20)) m.drawmeridians(np.arange(-180,180,30)) plt.title('Gnomonic Projection') -plt.savefig('gnomon.png') +plt.show() diff --git a/doc/users/figures/graticule.py b/doc/users/figures/graticule.py index f8365ebed..bc05a7b0b 100644 --- a/doc/users/figures/graticule.py +++ b/doc/users/figures/graticule.py @@ -20,4 +20,4 @@ m.drawparallels(parallels,labels=[False,True,True,False]) meridians = np.arange(10.,351.,20.) m.drawmeridians(meridians,labels=[True,False,False,True]) -plt.savefig('graticule.png') +plt.show() diff --git a/doc/users/figures/hammer.py b/doc/users/figures/hammer.py index b13e45204..b24603ca8 100644 --- a/doc/users/figures/hammer.py +++ b/doc/users/figures/hammer.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,420.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Hammer Projection") -plt.savefig('hammer.png') +plt.show() diff --git a/doc/users/figures/hurrtracks.py b/doc/users/figures/hurrtracks.py index 64c0d9731..2c09020c6 100644 --- a/doc/users/figures/hurrtracks.py +++ b/doc/users/figures/hurrtracks.py @@ -39,4 +39,4 @@ m.drawparallels(np.arange(10,70,20),labels=[1,1,0,0]) m.drawmeridians(np.arange(-100,0,20),labels=[0,0,0,1]) plt.title('Atlantic Hurricane Tracks (Storms Reaching Category 4, 1851-2004)') -plt.savefig('hurrtracks.png') +plt.show() diff --git a/doc/users/figures/kav7.py b/doc/users/figures/kav7.py index a31b50ee7..81daa95fb 100644 --- a/doc/users/figures/kav7.py +++ b/doc/users/figures/kav7.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Kavrayskiy VII Projection") -plt.savefig('kav7.png') +plt.show() diff --git a/doc/users/figures/laea.py b/doc/users/figures/laea.py index ca50e059a..cdd530c8c 100644 --- a/doc/users/figures/laea.py +++ b/doc/users/figures/laea.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,1.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("Lambert Azimuthal Equal Area Projection") -plt.savefig('laea.png') +plt.show() diff --git a/doc/users/figures/lcc.py b/doc/users/figures/lcc.py index 76bacdb1a..9fa9fb44a 100644 --- a/doc/users/figures/lcc.py +++ b/doc/users/figures/lcc.py @@ -26,4 +26,4 @@ poly = m.tissot(lon,lat,1.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("Lambert Conformal Projection") -plt.savefig('lcc.png') +plt.show() diff --git a/doc/users/figures/make.py b/doc/users/figures/make.py deleted file mode 100755 index 5e2ec2f13..000000000 --- a/doc/users/figures/make.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -import sys, os, glob -import matplotlib -#import IPython.Shell # for Ipython 0.10 -import IPython.core.interactiveshell -matplotlib.rcdefaults() -matplotlib.use('Agg') - -#mplshell = IPython.Shell.MatplotlibShell('mpl') # for Ipython 0.10 -mplshell = IPython.core.interactiveshell.InteractiveShell() # for Ipython 0.11 - -#formats = [('png', 100), -# ('hires.png', 200), -# ('pdf', 72)] -formats = [('png', 100)] - -def figs(): - print 'making figs' - import matplotlib.pyplot as plt - for fname in glob.glob('*.py'): - if fname.split('/')[-1] == __file__.split('/')[-1]: continue - basename, ext = os.path.splitext(fname) - imagefiles = dict([('%s.%s'%(basename, format), dpi) - for format, dpi in formats]) - all_exists = True - for imagefile in imagefiles: - if not os.path.exists(imagefile): - all_exists = False - break - - if all_exists: - print ' already have %s'%fname - else: - print ' building %s'%fname - plt.close('all') # we need to clear between runs - mplshell.magic_run(basename) - for imagefile, dpi in imagefiles.iteritems(): - plt.savefig(imagefile, dpi=dpi) - print 'all figures made' - - -def clean(): - patterns = (['#*', '*~', '*pyc'] + - ['*.%s' % format for format, dpi in formats]) - for pattern in patterns: - for fname in glob.glob(pattern): - os.remove(fname) - print 'all clean' - - - -def all(): - figs() - -funcd = {'figs':figs, - 'clean':clean, - 'all':all, - } - -if len(sys.argv)>1: - for arg in sys.argv[1:]: - func = funcd.get(arg) - if func is None: - raise SystemExit('Do not know how to handle %s; valid args are'%( - arg, funcd.keys())) - func() -else: - all() - - - - diff --git a/doc/users/figures/mbtfpq.py b/doc/users/figures/mbtfpq.py index 3f189b78e..43d74795d 100644 --- a/doc/users/figures/mbtfpq.py +++ b/doc/users/figures/mbtfpq.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("McBryde-Thomas Flat Polar Quartic Projection") -plt.savefig('mbtfpq.png') +plt.show() diff --git a/doc/users/figures/merc.py b/doc/users/figures/merc.py index 0c8c42393..adc57c6d6 100644 --- a/doc/users/figures/merc.py +++ b/doc/users/figures/merc.py @@ -15,4 +15,4 @@ m.drawmeridians(np.arange(-180.,181.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Mercator Projection") -plt.savefig('merc.png') +plt.show() diff --git a/doc/users/figures/mill.py b/doc/users/figures/mill.py index 7319945a7..0f730c3cf 100644 --- a/doc/users/figures/mill.py +++ b/doc/users/figures/mill.py @@ -14,4 +14,4 @@ m.drawmeridians(np.arange(-180.,181.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Miller Cylindrical Projection") -plt.savefig('mill.png') +plt.show() diff --git a/doc/users/figures/moll.py b/doc/users/figures/moll.py index 1351078ed..b059504e8 100644 --- a/doc/users/figures/moll.py +++ b/doc/users/figures/moll.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,420.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Mollweide Projection") -plt.savefig('moll.png') +plt.show() diff --git a/doc/users/figures/npaeqd.py b/doc/users/figures/npaeqd.py index 585bb657c..d485aa52a 100644 --- a/doc/users/figures/npaeqd.py +++ b/doc/users/figures/npaeqd.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("North Polar Azimuthal Equidistant Projection") -plt.savefig('npaeqd.png') +plt.show() diff --git a/doc/users/figures/nplaea.py b/doc/users/figures/nplaea.py index 7421394f4..62d077159 100644 --- a/doc/users/figures/nplaea.py +++ b/doc/users/figures/nplaea.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("North Polar Lambert Azimuthal Projection") -plt.savefig('nplaea.png') +plt.show() diff --git a/doc/users/figures/npstere.py b/doc/users/figures/npstere.py index 6a54b1081..7eb0b8054 100644 --- a/doc/users/figures/npstere.py +++ b/doc/users/figures/npstere.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("North Polar Stereographic Projection") -plt.savefig('npstere.png') +plt.show() diff --git a/doc/users/figures/nsper_full.py b/doc/users/figures/nsper_full.py index 2eb3b929a..cd03871c8 100644 --- a/doc/users/figures/nsper_full.py +++ b/doc/users/figures/nsper_full.py @@ -15,4 +15,4 @@ m.drawmapboundary(fill_color='aqua') plt.title("Full Disk Near-Sided Perspective Projection %d km above earth" % h,fontsize=10) -plt.savefig('nsper_full.png') +plt.show() diff --git a/doc/users/figures/nsper_partial.py b/doc/users/figures/nsper_partial.py index ac50d71eb..d5df892e1 100644 --- a/doc/users/figures/nsper_partial.py +++ b/doc/users/figures/nsper_partial.py @@ -30,4 +30,4 @@ m.drawmapboundary() plt.title('Near-Sided Perspective Map Showing A Quadrant of the Globe',\ fontsize=12) -plt.savefig('nsper_partial.png') +plt.show() diff --git a/doc/users/figures/omerc.py b/doc/users/figures/omerc.py index a8072b51a..0d081cbdd 100644 --- a/doc/users/figures/omerc.py +++ b/doc/users/figures/omerc.py @@ -21,4 +21,4 @@ m.drawmeridians(np.arange(-180.,181.,20.)) m.drawmapboundary(fill_color='aqua') plt.title("Oblique Mercator Projection") -plt.savefig('omerc.png') +plt.show() diff --git a/doc/users/figures/ortho_full.py b/doc/users/figures/ortho_full.py index a3dc536ad..a3035f3a1 100644 --- a/doc/users/figures/ortho_full.py +++ b/doc/users/figures/ortho_full.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,420.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Full Disk Orthographic Projection") -plt.savefig('ortho_full.png') +plt.show() diff --git a/doc/users/figures/ortho_partial.py b/doc/users/figures/ortho_partial.py index c6d688692..2ce95238c 100644 --- a/doc/users/figures/ortho_partial.py +++ b/doc/users/figures/ortho_partial.py @@ -25,4 +25,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary() plt.title('Orthographic Map Showing A Quadrant of the Globe') -plt.savefig('ortho_partial.png') +plt.show() diff --git a/doc/users/figures/plotargo.py b/doc/users/figures/plotargo.py index f88e57f5b..d9e3f1e91 100644 --- a/doc/users/figures/plotargo.py +++ b/doc/users/figures/plotargo.py @@ -25,4 +25,4 @@ def datetomsecs(d): m.scatter(x,y,3,marker='o',color='k') plt.title('Locations of %s ARGO floats active between %s and %s' %\ (len(lats),date1.strftime('%Y%m%d'),date2.strftime('%Y%m%d'))) -plt.savefig('plotargo.png') +plt.show() diff --git a/doc/users/figures/plotboulder.py b/doc/users/figures/plotboulder.py index b0d182b26..84e2ab219 100644 --- a/doc/users/figures/plotboulder.py +++ b/doc/users/figures/plotboulder.py @@ -29,4 +29,4 @@ # put some text next to the dot, offset a little bit # (the offset is in map projection coordinates) plt.text(xpt+100000,ypt+100000,'Boulder (%5.1fW,%3.1fN)' % (lonpt,latpt)) -plt.savefig('plotboulder.png') +plt.show() diff --git a/doc/users/figures/plotdaynight.py b/doc/users/figures/plotdaynight.py index 87c630672..ac1f7bc34 100644 --- a/doc/users/figures/plotdaynight.py +++ b/doc/users/figures/plotdaynight.py @@ -16,4 +16,4 @@ date = datetime.utcnow() CS=map.nightshade(date) plt.title('Day/Night Map for %s (UTC)' % date.strftime("%d %b %Y %H:%M:%S")) -plt.savefig('plotdaynight.png') +plt.show() diff --git a/doc/users/figures/plotetopo5.py b/doc/users/figures/plotetopo5.py index 7900c8310..7332c05e3 100644 --- a/doc/users/figures/plotetopo5.py +++ b/doc/users/figures/plotetopo5.py @@ -4,8 +4,9 @@ from netCDF4 import Dataset # read in etopo5 topography/bathymetry. -etopodata =\ -Dataset('http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc') +url = 'http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/etopo5.nc' +etopodata = Dataset(url) + topoin = etopodata.variables['ROSE'][:] lons = etopodata.variables['ETOPO05_X'][:] lats = etopodata.variables['ETOPO05_Y'][:] @@ -41,7 +42,7 @@ # add colorbar cb = m.colorbar(im,"right", size="5%", pad='2%') ax.set_title('ETOPO5 Topography - Lambert Conformal Conic') -fig.savefig('etopo5.png') +plt.show() # make a shaded relief plot. @@ -62,4 +63,4 @@ m.drawcountries() m.drawstates() ax.set_title('Shaded ETOPO5 Topography - Lambert Conformal Conic') -fig.savefig('etopo5_shaded.png') +plt.show() diff --git a/doc/users/figures/plotgreatcircle.py b/doc/users/figures/plotgreatcircle.py index e15da0bbc..3e13c86a1 100644 --- a/doc/users/figures/plotgreatcircle.py +++ b/doc/users/figures/plotgreatcircle.py @@ -22,4 +22,4 @@ # draw meridians m.drawmeridians(np.arange(-180,180,30),labels=[1,1,0,1]) ax.set_title('Great Circle from New York to London') -plt.savefig('plotgreatcircle.png') +plt.show() diff --git a/doc/users/figures/plothighsandlows.py b/doc/users/figures/plothighsandlows.py index 42e1e3799..d7cfb4a3b 100644 --- a/doc/users/figures/plothighsandlows.py +++ b/doc/users/figures/plothighsandlows.py @@ -85,4 +85,4 @@ def extrema(mat,mode='wrap',window=10): bbox = dict(boxstyle="square",ec='None',fc=(1,1,1,0.5))) xyplotted.append((x,y)) plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % YYYYMMDDHH) -plt.savefig('plothighsandlows.png') +plt.show() diff --git a/doc/users/figures/plotprecip.py b/doc/users/figures/plotprecip.py index 1612fc281..08546fd6f 100644 --- a/doc/users/figures/plotprecip.py +++ b/doc/users/figures/plotprecip.py @@ -46,4 +46,4 @@ cbar.set_label('mm') # add title plt.title(prcpvar.long_name+' for period ending '+prcpvar.dateofdata) -plt.savefig('plotprecip.png') +plt.show() diff --git a/doc/users/figures/plotsst.py b/doc/users/figures/plotsst.py index 9b34dacdc..8a2eae961 100644 --- a/doc/users/figures/plotsst.py +++ b/doc/users/figures/plotsst.py @@ -51,4 +51,4 @@ cb = m.colorbar(im1,"bottom", size="5%", pad="2%") # add a title. ax.set_title('SST and ICE analysis for %s'%date) -plt.savefig('plotsst.png') +plt.show() diff --git a/doc/users/figures/plotwindvec.py b/doc/users/figures/plotwindvec.py index 4b540e350..a791a574e 100644 --- a/doc/users/figures/plotwindvec.py +++ b/doc/users/figures/plotwindvec.py @@ -68,7 +68,7 @@ cb.set_label('hPa') # set plot title ax.set_title('SLP and Wind Vectors '+str(date)) -fig1.savefig('plotwindvec1.png') +plt.show() # create 2nd figure, add axes fig2 = plt.figure(figsize=(8,10)) @@ -87,4 +87,4 @@ cb.set_label('hPa') # set plot title. ax.set_title('SLP and Wind Barbs '+str(date)) -fig2.savefig('plotwindvec2.png') +plt.show() diff --git a/doc/users/figures/poly.py b/doc/users/figures/poly.py index ef6d6e9be..6e32b0ff3 100644 --- a/doc/users/figures/poly.py +++ b/doc/users/figures/poly.py @@ -15,4 +15,4 @@ m.drawmeridians(np.arange(-180.,181.,20.)) m.drawmapboundary(fill_color='aqua') plt.title("Polyconic Projection") -plt.savefig('poly.png') +plt.show() diff --git a/doc/users/figures/robin.py b/doc/users/figures/robin.py index 9d36bc384..d4ab2d960 100644 --- a/doc/users/figures/robin.py +++ b/doc/users/figures/robin.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Robinson Projection") -plt.savefig('robin.png') +plt.show() diff --git a/doc/users/figures/sinu.py b/doc/users/figures/sinu.py index d4d8deef4..8747d8033 100644 --- a/doc/users/figures/sinu.py +++ b/doc/users/figures/sinu.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,420.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("Sinusoidal Projection") -plt.savefig('sinu.png') +plt.show() diff --git a/doc/users/figures/spaeqd.py b/doc/users/figures/spaeqd.py index a5bd38ad1..be6f7b5d0 100644 --- a/doc/users/figures/spaeqd.py +++ b/doc/users/figures/spaeqd.py @@ -20,4 +20,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("South Polar Azimuthal Equidistant Projection") -plt.savefig('spaeqd.png') +plt.show() diff --git a/doc/users/figures/splaea.py b/doc/users/figures/splaea.py index ee3bc62f1..06c94174d 100644 --- a/doc/users/figures/splaea.py +++ b/doc/users/figures/splaea.py @@ -20,4 +20,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("South Polar Lambert Azimuthal Projection") -plt.savefig('splaea.png') +plt.show() diff --git a/doc/users/figures/spstere.py b/doc/users/figures/spstere.py index c61106d55..e251dbd6e 100644 --- a/doc/users/figures/spstere.py +++ b/doc/users/figures/spstere.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,2.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("South Polar Stereographic Projection") -plt.savefig('spstere.png') +plt.show() diff --git a/doc/users/figures/stere.py b/doc/users/figures/stere.py index 309af5114..b2bd9c956 100644 --- a/doc/users/figures/stere.py +++ b/doc/users/figures/stere.py @@ -21,4 +21,4 @@ poly = m.tissot(lon,lat,1.5,100,\ facecolor='green',zorder=10,alpha=0.5) plt.title("Stereographic Projection") -plt.savefig('stere.png') +plt.show() diff --git a/doc/users/figures/tmerc.py b/doc/users/figures/tmerc.py index 4271e609f..ea878482a 100644 --- a/doc/users/figures/tmerc.py +++ b/doc/users/figures/tmerc.py @@ -19,4 +19,4 @@ m.drawmeridians(np.arange(-20.,21.,2.)) m.drawmapboundary(fill_color='aqua') plt.title("Transverse Mercator Projection") -plt.savefig('tmerc.png') +plt.show() diff --git a/doc/users/figures/vandg.py b/doc/users/figures/vandg.py index afcd93da4..03db2a394 100644 --- a/doc/users/figures/vandg.py +++ b/doc/users/figures/vandg.py @@ -11,4 +11,4 @@ m.drawmeridians(np.arange(0.,360.,60.)) m.drawmapboundary(fill_color='aqua') plt.title("van der Grinten Projection") -plt.savefig('vandg.png') +plt.show() diff --git a/doc/users/gall.rst b/doc/users/gall.rst index 7bda94f6c..61407ad84 100644 --- a/doc/users/gall.rst +++ b/doc/users/gall.rst @@ -6,6 +6,4 @@ Gall Stereographic Projection A stereographic, cylindrical projection that is neither equal-area or conformal. -.. literalinclude:: figures/gall.py - -.. image:: figures/gall.png +.. plot:: users/figures/gall.py diff --git a/doc/users/geography.rst b/doc/users/geography.rst index faf460dcd..4b2ee3db9 100644 --- a/doc/users/geography.rst +++ b/doc/users/geography.rst @@ -53,30 +53,20 @@ Here are examples of the various ways to draw a map background. 1. Draw coastlines, filling ocean and land areas. -.. literalinclude:: figures/background1.py - -.. image:: figures/background1.png +.. plot:: users/figures/background1.py 2. Draw a land-sea mask as an image. -.. literalinclude:: figures/background2.py - -.. image:: figures/background2.png +.. plot:: users/figures/background2.py 3. Draw the NASA 'Blue Marble' image. -.. literalinclude:: figures/background3.py - -.. image:: figures/background3.png +.. plot:: users/figures/background3.py 4. Draw a shaded relief image. -.. literalinclude:: figures/background4.py - -.. image:: figures/background4.png +.. plot:: users/figures/background4.py 5. Draw an etopo relief image. -.. literalinclude:: figures/background5.py - -.. image:: figures/background5.png +.. plot:: users/figures/background5.py diff --git a/doc/users/geos.rst b/doc/users/geos.rst index 36ca380ee..6ef911ead 100644 --- a/doc/users/geos.rst +++ b/doc/users/geos.rst @@ -6,10 +6,6 @@ Geostationary Projection The geostationary projection displays the earth as a satellite (in geostationary orbit) would see it. -.. literalinclude:: figures/geos_full.py +.. plot:: users/figures/geos_full.py -.. image:: figures/geos_full.png - -.. literalinclude:: figures/geos_partial.py - -.. image:: figures/geos_partial.png +.. plot:: users/figures/geos_partial.py diff --git a/doc/users/gnomon.rst b/doc/users/gnomon.rst index 1e7e1f29b..5009ee6e7 100644 --- a/doc/users/gnomon.rst +++ b/doc/users/gnomon.rst @@ -5,6 +5,4 @@ Gnomonic Projection In the gnomonic projection, great circles are straight lines. -.. literalinclude:: figures/gnomon.py - -.. image:: figures/gnomon.png +.. plot:: users/figures/gnomon.py diff --git a/doc/users/graticule.rst b/doc/users/graticule.rst index 18739d9fc..dcac567ce 100644 --- a/doc/users/graticule.rst +++ b/doc/users/graticule.rst @@ -22,8 +22,6 @@ they really need to be labelled manually on the interior of the plot. Here's an example that shows how to draw parallels and meridians and label them on different sides of the plot. -.. literalinclude:: figures/graticule.py - -.. image:: figures/graticule.png +.. plot:: users/figures/graticule.py .. toctree:: diff --git a/doc/users/hammer.rst b/doc/users/hammer.rst index 32040381f..06098e0fc 100644 --- a/doc/users/hammer.rst +++ b/doc/users/hammer.rst @@ -5,6 +5,4 @@ Hammer Projection The hammer projection is a global, elliptical, equal-area projection. -.. literalinclude:: figures/hammer.py - -.. image:: figures/hammer.png +.. plot:: users/figures/hammer.py diff --git a/doc/users/kav7.rst b/doc/users/kav7.rst index 27422cbde..714f072b5 100644 --- a/doc/users/kav7.rst +++ b/doc/users/kav7.rst @@ -5,6 +5,4 @@ Kavrayskiy VII Projection A global projection similar to Robinson, used widely in the former Soviet Union. -.. literalinclude:: figures/kav7.py - -.. image:: figures/kav7.png +.. plot:: users/figures/kav7.py diff --git a/doc/users/laea.rst b/doc/users/laea.rst index 55f706ee5..af4f0334f 100644 --- a/doc/users/laea.rst +++ b/doc/users/laea.rst @@ -10,6 +10,4 @@ On a conformal projection, the shape of the circles is preserved, but the area is not. On a equal-area projection, the area is preserved but the shape is not. -.. literalinclude:: figures/laea.py - -.. image:: figures/laea.png +.. plot:: users/figures/laea.py diff --git a/doc/users/lcc.rst b/doc/users/lcc.rst index 6cd6b43a4..d52d0a066 100644 --- a/doc/users/lcc.rst +++ b/doc/users/lcc.rst @@ -10,6 +10,4 @@ On a conformal projection, the shape of the circles is preserved, but the area is not. On a equal-area projection, the area is preserved but the shape is not. -.. literalinclude:: figures/lcc.py - -.. image:: figures/lcc.png +.. plot:: users/figures/lcc.py diff --git a/doc/users/mapcoords.rst b/doc/users/mapcoords.rst index 6fef50078..84436e14f 100644 --- a/doc/users/mapcoords.rst +++ b/doc/users/mapcoords.rst @@ -12,8 +12,6 @@ convert lon/lat (in degrees) to x/y map projection coordinates Here's an example that uses this feature to plot a marker and some text to denote the location of Boulder, CO, given the lat/lon position. -.. literalinclude:: figures/plotboulder.py - -.. image:: figures/plotboulder.png +.. plot:: users/figures/plotboulder.py .. toctree:: diff --git a/doc/users/mbtfpq.rst b/doc/users/mbtfpq.rst index 3800dd024..9eae8b0ab 100644 --- a/doc/users/mbtfpq.rst +++ b/doc/users/mbtfpq.rst @@ -5,6 +5,4 @@ McBryde-Thomas Flat Polar Quartic A global equal-area projection. -.. literalinclude:: figures/mbtfpq.py - -.. image:: figures/mbtfpq.png +.. plot:: users/figures/mbtfpq.py diff --git a/doc/users/merc.rst b/doc/users/merc.rst index 0873996cf..6ab0af8aa 100644 --- a/doc/users/merc.rst +++ b/doc/users/merc.rst @@ -5,6 +5,4 @@ Mercator Projection A cylindrical, conformal projection. Very large distortion at high latitudes, cannot fully reach the polar regions. -.. literalinclude:: figures/merc.py - -.. image:: figures/merc.png +.. plot:: users/figures/merc.py diff --git a/doc/users/mill.rst b/doc/users/mill.rst index ad6dfe190..6c6428db9 100644 --- a/doc/users/mill.rst +++ b/doc/users/mill.rst @@ -6,6 +6,4 @@ Miller Cylindrical Projection A modified version of the mercator projection that avoids the polar singularity. Neither equal-area or conformal. -.. literalinclude:: figures/mill.py - -.. image:: figures/mill.png +.. plot:: users/figures/mill.py diff --git a/doc/users/moll.rst b/doc/users/moll.rst index 5931b7d11..e78d31c98 100644 --- a/doc/users/moll.rst +++ b/doc/users/moll.rst @@ -5,6 +5,4 @@ Mollweide Projection The mollweide projection is a global, elliptical, equal-area projection. -.. literalinclude:: figures/moll.py - -.. image:: figures/moll.png +.. plot:: users/figures/moll.py diff --git a/doc/users/nsper.rst b/doc/users/nsper.rst index ff5819578..729971d32 100644 --- a/doc/users/nsper.rst +++ b/doc/users/nsper.rst @@ -6,10 +6,6 @@ Near-Sided Perspective Projection The near-sided perspective projection displays the earth as a satellite (in orbit at an arbitrary altitude above the earth) would see it. -.. literalinclude:: figures/nsper_full.py +.. plot:: users/figures/nsper_full.py -.. image:: figures/nsper_full.png - -.. literalinclude:: figures/nsper_partial.py - -.. image:: figures/nsper_partial.png +.. plot:: users/figures/nsper_partial.py diff --git a/doc/users/omerc.rst b/doc/users/omerc.rst index 0e8faba8b..e8116bdf2 100644 --- a/doc/users/omerc.rst +++ b/doc/users/omerc.rst @@ -9,6 +9,4 @@ the regular mercator projection) or a longitude (as in the transverse mercator projection) can be an arbitrary great circle (defined by specifying two points). -.. literalinclude:: figures/omerc.py - -.. image:: figures/omerc.png +.. plot:: users/figures/omerc.py diff --git a/doc/users/ortho.rst b/doc/users/ortho.rst index 458efff45..d188b3f16 100644 --- a/doc/users/ortho.rst +++ b/doc/users/ortho.rst @@ -6,10 +6,6 @@ Orthographic Projection The orthographic projection displays the earth as a satellite (in an orbit infinitely high above the earth) would see it. -.. literalinclude:: figures/ortho_full.py +.. plot:: users/figures/ortho_full.py -.. image:: figures/ortho_full.png - -.. literalinclude:: figures/ortho_partial.py - -.. image:: figures/ortho_partial.png +.. plot:: users/figures/ortho_partial.py diff --git a/doc/users/paeqd.rst b/doc/users/paeqd.rst index 47163697e..1d80a72ba 100644 --- a/doc/users/paeqd.rst +++ b/doc/users/paeqd.rst @@ -6,10 +6,6 @@ Polar Azimuthal Equidistant Projection For convenience, the projections ``npaeqd`` and ``spaeqd`` are provided for easy access to the polar aspect of the azimuthal equidistant projection. -.. literalinclude:: figures/npaeqd.py +.. plot:: users/figures/npaeqd.py -.. image:: figures/npaeqd.png - -.. literalinclude:: figures/spaeqd.py - -.. image:: figures/spaeqd.png +.. plot:: users/figures/spaeqd.py diff --git a/doc/users/plaea.rst b/doc/users/plaea.rst index 0eb131c72..9b66c2a88 100644 --- a/doc/users/plaea.rst +++ b/doc/users/plaea.rst @@ -7,10 +7,6 @@ For convenience, the projections ``nplaea`` and ``splaea`` are provided for easy access to the polar aspect of the lambert azimuthal equal-area projection. -.. literalinclude:: figures/nplaea.py +.. plot:: users/figures/nplaea.py -.. image:: figures/nplaea.png - -.. literalinclude:: figures/splaea.py - -.. image:: figures/splaea.png +.. plot:: users/figures/splaea.py diff --git a/doc/users/poly.rst b/doc/users/poly.rst index a4a979d7e..ee0123a85 100644 --- a/doc/users/poly.rst +++ b/doc/users/poly.rst @@ -3,6 +3,4 @@ Polyconic Projection ==================== -.. literalinclude:: figures/poly.py - -.. image:: figures/poly.png +.. plot:: users/figures/poly.py diff --git a/doc/users/pstere.rst b/doc/users/pstere.rst index f011b2d3b..188275408 100644 --- a/doc/users/pstere.rst +++ b/doc/users/pstere.rst @@ -6,10 +6,6 @@ Polar Stereographic Projection For convenience, the projections ``npstere`` and ``spstere`` are provided for easy access to the polar aspect of the stereographic conformal projection. -.. literalinclude:: figures/npstere.py +.. plot:: users/figures/npstere.py -.. image:: figures/npstere.png - -.. literalinclude:: figures/spstere.py - -.. image:: figures/spstere.png +.. plot:: users/figures/spstere.py diff --git a/doc/users/robin.rst b/doc/users/robin.rst index fd6adad81..834832893 100644 --- a/doc/users/robin.rst +++ b/doc/users/robin.rst @@ -5,6 +5,4 @@ Robinson Projection A global projection once used by the National Geographic Society for world maps. -.. literalinclude:: figures/robin.py - -.. image:: figures/robin.png +.. plot:: users/figures/robin.py diff --git a/doc/users/sinu.rst b/doc/users/sinu.rst index 30b1b08bd..0175f2e72 100644 --- a/doc/users/sinu.rst +++ b/doc/users/sinu.rst @@ -6,6 +6,4 @@ Sinusoidal Projection A global equal-area projection where the length of each parallel is equal to the cosine of the latitude. -.. literalinclude:: figures/sinu.py - -.. image:: figures/sinu.png +.. plot:: users/figures/sinu.py diff --git a/doc/users/stere.rst b/doc/users/stere.rst index e641ea203..45bbaa68f 100644 --- a/doc/users/stere.rst +++ b/doc/users/stere.rst @@ -10,6 +10,4 @@ On a conformal projection, the shape of the circles is preserved, but the area is not. On a equal-area projection, the area is preserved but the shape is not. -.. literalinclude:: figures/stere.py - -.. image:: figures/stere.png +.. plot:: users/figures/stere.py diff --git a/doc/users/tmerc.rst b/doc/users/tmerc.rst index a02909acb..f706b70a7 100644 --- a/doc/users/tmerc.rst +++ b/doc/users/tmerc.rst @@ -7,6 +7,4 @@ The transverse aspect of the mercator projection. The globe is first rotated so the central meridian becomes the "equator", and then the normal mercator projection is applied. -.. literalinclude:: figures/tmerc.py - -.. image:: figures/tmerc.png +.. plot:: users/figures/tmerc.py diff --git a/doc/users/vandg.rst b/doc/users/vandg.rst index 103e681e5..1a2b1e917 100644 --- a/doc/users/vandg.rst +++ b/doc/users/vandg.rst @@ -7,6 +7,4 @@ A global projection once used by the National Geographic Society for world maps. Neither equal area or conformal, shows the world in a circle centered on the equator. -.. literalinclude:: figures/vandg.py - -.. image:: figures/vandg.png +.. plot:: users/figures/vandg.py