diff --git a/.travis.yml b/.travis.yml index ee920bc7bf5e..bb43b9ae0a5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ addons: - texlive-latex-recommended - texlive-xetex - graphviz + - libgeos-dev # - fonts-humor-sans # sources: # - debian-sid @@ -115,6 +116,13 @@ install: fi; - python setup.py install + - | + # Installing basemap from github until it's back on pypi + # We have to install it after matplotlib to avoid pulling in MPL as + # a dependency + if [[ $BUILD_DOCS == true ]]; then + pip install https://github.com/matplotlib/basemap/tarball/master + fi; script: # The number of processes is hardcoded, because using too many causes the @@ -127,7 +135,7 @@ script: gdb -return-child-result -batch -ex r -ex bt --args python tests.py -s --processes=$NPROC --process-timeout=300 $TEST_ARGS else cd doc - python make.py html --small --warningsaserrors + python make.py html --small # We don't build the LaTeX docs here, so linkchecker will complain touch build/html/Matplotlib.pdf linkchecker build/html/index.html diff --git a/doc/make.py b/doc/make.py index 783e159be23c..1139370d10d2 100755 --- a/doc/make.py +++ b/doc/make.py @@ -138,7 +138,7 @@ def all(): small_docs = False -warnings_as_errors = False +warnings_as_errors = True # Change directory to the one containing this file current_dir = os.getcwd() @@ -184,14 +184,14 @@ def all(): parser.add_argument("--small", help="Smaller docs with only low res png figures", action="store_true") -parser.add_argument("--warningsaserrors", - help="Turn Sphinx warnings into errors", +parser.add_argument("--allowsphinxwarnings", + help="Don't turn Sphinx warnings into errors", action="store_true") args = parser.parse_args() if args.small: small_docs = True -if args.warningsaserrors: - warnings_as_errors = True +if args.allowsphinxwarnings: + warnings_as_errors = False if args.cmd: for command in args.cmd: diff --git a/doc/pyplots/README b/doc/pyplots/README deleted file mode 100644 index 464d7067e6fc..000000000000 --- a/doc/pyplots/README +++ /dev/null @@ -1,10 +0,0 @@ -Please add a line to this file for any additional requirements necessary to -generate a new figure. - -tex_demo.py and tex_unicode_demo.py: - latex - dvipng - - -plotmap.py: - basemap toolkit diff --git a/doc/pyplots/make.py b/doc/pyplots/make.py deleted file mode 100755 index cc58688aa66b..000000000000 --- a/doc/pyplots/make.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function -import sys, os, glob -import matplotlib -import IPython.Shell -#matplotlib.rcdefaults() -matplotlib.use('Agg') - -mplshell = IPython.Shell.MatplotlibShell('mpl') - -formats = [('png', 100), - ('hires.png', 200), - ('pdf', 72)] - -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(): - # todo: this will get called even if the run script - # fails and exits, thus creating a stub pdf and png - # iles preventing them from getting built successfully - # later - 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/pyplots/plotmap.hires.png b/doc/pyplots/plotmap.hires.png deleted file mode 100644 index b1d0c35540a5..000000000000 Binary files a/doc/pyplots/plotmap.hires.png and /dev/null differ diff --git a/doc/pyplots/plotmap.pdf b/doc/pyplots/plotmap.pdf deleted file mode 100644 index ad51edbb7597..000000000000 Binary files a/doc/pyplots/plotmap.pdf and /dev/null differ diff --git a/doc/pyplots/plotmap.png b/doc/pyplots/plotmap.png deleted file mode 100644 index 5f33c425a335..000000000000 Binary files a/doc/pyplots/plotmap.png and /dev/null differ diff --git a/doc/pyplots/plotmap.py b/doc/pyplots/plotmap.py index 98a5d64bb135..6ccb093de3cd 100644 --- a/doc/pyplots/plotmap.py +++ b/doc/pyplots/plotmap.py @@ -1,31 +1,29 @@ import matplotlib.pyplot as plt import numpy as np -try: - from mpl_toolkits.basemap import Basemap - have_basemap = True -except ImportError: - have_basemap = False +from mpl_toolkits.basemap import Basemap def plotmap(): # create figure - fig = plt.figure(figsize=(8,8)) + fig = plt.figure(figsize=(8, 8)) # set up orthographic map projection with # perspective of satellite looking down at 50N, 100W. # use low resolution coastlines. - map = Basemap(projection='ortho',lat_0=50,lon_0=-100,resolution='l') + map = Basemap(projection='ortho', lat_0=50, lon_0=-100, resolution='l') # lat/lon coordinates of five cities. - lats=[40.02,32.73,38.55,48.25,17.29] - lons=[-105.16,-117.16,-77.00,-114.21,-88.10] - cities=['Boulder, CO','San Diego, CA', - 'Washington, DC','Whitefish, MT','Belize City, Belize'] + lats = [40.02, 32.73, 38.55, 48.25, 17.29] + lons = [-105.16, -117.16, -77.00, -114.21, -88.10] + cities = ['Boulder, CO', 'San Diego, CA', + 'Washington, DC', 'Whitefish, MT', 'Belize City, Belize'] # compute the native map projection coordinates for cities. - xc,yc = map(lons,lats) + xc, yc = map(lons, lats) # make up some data on a regular lat/lon grid. - nlats = 73; nlons = 145; delta = 2.*np.pi/(nlons-1) - lats = (0.5*np.pi-delta*np.indices((nlats,nlons))[0,:,:]) - lons = (delta*np.indices((nlats,nlons))[1,:,:]) + nlats = 73 + nlons = 145 + delta = 2.*np.pi/(nlons-1) + lats = (0.5*np.pi-delta*np.indices((nlats,nlons))[0, :, :]) + lons = (delta*np.indices((nlats, nlons))[1, :, :]) wave = 0.75*(np.sin(2.*lats)**8*np.cos(4.*lons)) mean = 0.5*np.cos(2.*lats)*((np.sin(2.*lats))**2 + 2.) # compute native map projection coordinates of lat/lon grid. @@ -34,28 +32,18 @@ def plotmap(): # draw map boundary map.drawmapboundary(color="0.9") # draw graticule (latitude and longitude grid lines) - map.drawmeridians(np.arange(0,360,30),color="0.9") - map.drawparallels(np.arange(-90,90,30),color="0.9") + map.drawmeridians(np.arange(0, 360, 30), color="0.9") + map.drawparallels(np.arange(-90, 90, 30), color="0.9") # plot filled circles at the locations of the cities. - map.plot(xc,yc,'wo') + map.plot(xc, yc, 'wo') # plot the names of five cities. - for name,xpt,ypt in zip(cities,xc,yc): - plt.text(xpt+100000,ypt+100000,name,fontsize=9,color='w') + for name, xpt, ypt in zip(cities, xc, yc): + plt.text(xpt+100000, ypt+100000, name, fontsize=9, color='w') # contour data over the map. - cs = map.contour(x,y,wave+mean,15,linewidths=1.5) + cs = map.contour(x, y, wave+mean, 15, linewidths=1.5) # draw blue marble image in background. # (downsample the image by 50% for speed) map.bluemarble(scale=0.5) -def plotempty(): - # create figure - fig = plt.figure(figsize=(8,8)) - fig.text(0.5, 0.5, "Sorry, could not import Basemap", - horizontalalignment='center') - -if have_basemap: - plotmap() -else: - plotempty() +plotmap() plt.show() - diff --git a/doc/pyplots/tex_demo.pdf b/doc/pyplots/tex_demo.pdf deleted file mode 100644 index 4462d92c99a9..000000000000 Binary files a/doc/pyplots/tex_demo.pdf and /dev/null differ diff --git a/doc/pyplots/tex_unicode_demo.hires.png b/doc/pyplots/tex_unicode_demo.hires.png deleted file mode 100644 index 52fc6b248bc6..000000000000 Binary files a/doc/pyplots/tex_unicode_demo.hires.png and /dev/null differ diff --git a/doc/pyplots/tex_unicode_demo.pdf b/doc/pyplots/tex_unicode_demo.pdf deleted file mode 100644 index c6e234d1d404..000000000000 Binary files a/doc/pyplots/tex_unicode_demo.pdf and /dev/null differ diff --git a/doc/pyplots/tex_unicode_demo.png b/doc/pyplots/tex_unicode_demo.png deleted file mode 100644 index db7e76dbebb3..000000000000 Binary files a/doc/pyplots/tex_unicode_demo.png and /dev/null differ