diff --git a/doc/_static/mpl.css b/doc/_static/mpl.css
index bd174f670d49..3c996ccc7b14 100644
--- a/doc/_static/mpl.css
+++ b/doc/_static/mpl.css
@@ -566,3 +566,18 @@ table.docutils td {
width: 30em;
}
+figure {
+ margin: 1em;
+ display: inline-block;
+}
+
+figure img {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+figcaption {
+ text-align: center;
+}
+
+
diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py
index 1c4c2b56a9a6..4d1a77a3245e 100644
--- a/doc/sphinxext/gen_gallery.py
+++ b/doc/sphinxext/gen_gallery.py
@@ -41,7 +41,10 @@
"""
link_template = """\
-
+
+ 
+ {title}
+
"""
toc_template = """\
@@ -122,7 +125,8 @@ def gen_gallery(app, doctree):
link = 'examples/%s/%s.html'%(subdir, basename)
rows.append(link_template.format(link=link,
thumb=thumbfile,
- basename=basename))
+ basename=basename
+ title=basename))
if len(data) == 0:
warnings.warn("No thumbnails were found in %s" % subdir)
diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py
index fecd56b85e42..c7e01585f83e 100644
--- a/doc/sphinxext/gen_rst.py
+++ b/doc/sphinxext/gen_rst.py
@@ -121,6 +121,7 @@ def generate_example_rst(app):
rstfile = '%s.rst'%basename
outrstfile = os.path.join(rstdir, rstfile)
+ # XXX make into title
fhsubdirIndex.write(' %s <%s>\n'%(os.path.basename(basename),rstfile))
do_plot = (subdir in example_subdirs