Skip to content

Commit eb27af0

Browse files
authored
Merge pull request #17477 from larsoner/anim
DOC: Use Sphinx-gallery animation capture
2 parents d03c337 + de0fb17 commit eb27af0

File tree

17 files changed

+36
-31
lines changed

17 files changed

+36
-31
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ apt-run: &apt-install
2727
graphviz \
2828
fonts-crosextra-carlito \
2929
fonts-freefont-otf \
30-
fonts-humor-sans
30+
fonts-humor-sans \
31+
optipng
3132
3233
fonts-run: &fonts-install
3334
name: Install custom fonts

doc/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ clean:
2424
rm -rf "$(SOURCEDIR)/savefig"
2525
rm -rf "$(SOURCEDIR)/sphinxext/__pycache__"
2626

27+
show:
28+
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(shell pwd)/build/html/index.html')"
29+
2730
# Catch-all target: route all unknown targets to Sphinx using the new
2831
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2932
%: Makefile

doc/_static/mpl.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ div.documentwrapper {
189189
}
190190
*/
191191

192-
div.clearer {
193-
clear: both;
194-
}
195-
196192
div.related h3 {
197193
display: none;
198194
}

doc/_templates/autosummary.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
creates no example file for those (sphinx-gallery/sphinx-gallery#365)
2222
2323
{% else %}
24-
.. include:: {{module}}.{{objname}}.examples
25-
26-
.. raw:: html
27-
28-
<div class="clearer"></div>
24+
.. minigallery:: {{module}}.{{objname}}
25+
:add-heading:
2926

3027
{% endif %}
3128
{% endif %}

doc/_templates/function.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55

66
.. autofunction:: {{ objname }}
77

8-
.. include:: {{module}}.{{objname}}.examples
9-
10-
.. raw:: html
11-
12-
<div class="clearer"></div>
8+
.. minigallery:: {{module}}.{{objname}}
9+
:add-heading:

doc/api/animation_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Examples
135135

136136
../gallery/animation/animate_decay
137137
../gallery/animation/bayes_update
138-
../gallery/animation/double_pendulum_sgskip
138+
../gallery/animation/double_pendulum
139139
../gallery/animation/animated_histogram
140140
../gallery/animation/rain
141141
../gallery/animation/random_walk

doc/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def _check_dependencies():
139139
'within_subsection_order': gallery_order.subsectionorder,
140140
'remove_config_comments': True,
141141
'min_reported_time': 1,
142+
'compress_images': ('thumbnails', 'images'),
143+
'matplotlib_animations': True,
142144
}
143145

144146
plot_gallery = 'True'

doc/devel/documenting_mpl.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,9 @@ Miscellaneous
890890
Adding animations
891891
-----------------
892892

893-
There is a Matplotlib Google/Gmail account with username ``mplgithub``
893+
Animations are scraped automatically by Sphinx-gallery. If this is not
894+
desired,
895+
there is also a Matplotlib Google/Gmail account with username ``mplgithub``
894896
which was used to setup the github account but can be used for other
895897
purposes, like hosting Google docs or Youtube videos. You can embed a
896898
Matplotlib animation in the docs by first saving the animation as a

doc/matplotlibrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ backend : Agg
22
figure.figsize : 5.5, 4.5 # figure size in inches
33
savefig.dpi : 80 # figure dots per inch
44
docstring.hardcopy : True # set this when you want to generate hardcopy docstring
5+
animation.embed_limit : 30 # allow embedded animations to be big

examples/animation/animated_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ def animate(i):
8787
ax.set_xlim(left[0], right[-1])
8888
ax.set_ylim(bottom.min(), top.max())
8989

90-
ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True)
90+
ani = animation.FuncAnimation(fig, animate, 50, repeat=False, blit=True)
9191
plt.show()

0 commit comments

Comments
 (0)