Skip to content

Added labels to images in the gallery [sprint] #2161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/_static/mpl.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


8 changes: 6 additions & 2 deletions doc/sphinxext/gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
</h4>"""

link_template = """\
<a href="{link}"><img src="{thumb}" border="0" alt="{basename}"/></a>
<figure>
<a href="{link}"><img src="{thumb}" border="0" alt="{basename}"/></a><br>
<figcaption><a href="{link}">{title}</a></figcaption>
</figure>
"""

toc_template = """\
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions doc/sphinxext/gen_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def generate_example_rst(app):
rstfile = '%s.rst'%basename
outrstfile = os.path.join(rstdir, rstfile)

# XXX make into title
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow this comment. Would you mind expanding on this (in this github interface before adding a new commit)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to write titles for each of the example plots, likely in a file-level docstring. I was just making a note to myself that if each plot has a title, then it'd be good to change the following line to something like fhsubdirIndex.write(' %s <%s>\n'%(filetitle,rstfile)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. Maybe you could update this comment along the lines of:

# XXX: We might consider putting extra metadata in the example files to include a title. If so, this line is where we would add this information.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2174.

fhsubdirIndex.write(' %s <%s>\n'%(os.path.basename(basename),rstfile))

do_plot = (subdir in example_subdirs
Expand Down