-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathMEP12.html
More file actions
382 lines (356 loc) · 21.2 KB
/
MEP12.html
File metadata and controls
382 lines (356 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MEP12: Improve Gallery and Examples — Matplotlib 2.0.2 documentation</title>
<link rel="stylesheet" href="../../_static/mpl.css"
type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css"
type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2.0.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 2.0.2 documentation"
href="../../_static/opensearch.xml"/>
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<link rel="index" title="Index" href="../../genindex.html"
/>
<link rel="search" title="Search" href="../../search.html"
/>
<link rel="top" title="Matplotlib 2.0.2 documentation" href="../../index.html" />
<link rel="up" title="Matplotlib Enhancement Proposals" href="index.html" />
<link rel="next" title="MEP13: Use properties for Artists" href="MEP13.html" />
<link rel="prev" title="MEP11: Third-party dependencies" href="MEP11.html" />
<link rel="canonical" href="https://matplotlib.org/stable/devel/MEP/MEP12.html" />
<script data-domain="matplotlib.org" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
</head>
<body>
<div id="unreleased-message"> You are reading an old version of the documentation (v2.0.2). For the latest version see <a href="https://matplotlib.org/stable/devel/MEP/MEP12.html">https://matplotlib.org/stable/devel/MEP/MEP12.html</a></div>
<!-- The "Fork me on github" ribbon -->
<img style="float: right; margin-bottom: -40px; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" usemap="#ribbonmap"/>
<map name="ribbonmap">
<area shape="poly" coords="15,0,148,-1,148,135" href="https://github.com/matplotlib/matplotlib" title="Fork me on GitHub" />
</map>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../../index.html"><img src="../../_static/logo2.svg" width="540px" border="0" alt="matplotlib"/></a>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="MEP13.html" title="MEP13: Use properties for Artists"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="MEP11.html" title="MEP11: Third-party dependencies"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">home</a>| </li>
<li><a href="../../examples/index.html">examples</a>| </li>
<li><a href="../../gallery.html">gallery</a>| </li>
<li><a href="../../api/pyplot_summary.html">pyplot</a>| </li>
<li><a href="../../contents.html">docs</a> »</li>
<li><a href="../index.html" >The Matplotlib Developers’ Guide</a> »</li>
<li><a href="index.html" accesskey="U">Matplotlib Enhancement Proposals</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<a href="http://depsy.org/package/python/matplotlib">
<img src="../../_static/depsy_badge.svg">
</a>
<br/>
Travis-CI: <a href="https://travis-ci.org/matplotlib/matplotlib">
<img src="https://travis-ci.org/matplotlib/matplotlib.svg?branch=master"/>
</a>
<br/>
<h3><a href="../../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">MEP12: Improve Gallery and Examples</a><ul>
<li><a class="reference internal" href="#status">Status</a></li>
<li><a class="reference internal" href="#branches-and-pull-requests">Branches and Pull requests</a></li>
<li><a class="reference internal" href="#abstract">Abstract</a></li>
<li><a class="reference internal" href="#detailed-description">Detailed description</a></li>
<li><a class="reference internal" href="#implementation">Implementation</a><ul>
<li><a class="reference internal" href="#gallery-sections">Gallery sections</a></li>
<li><a class="reference internal" href="#clean-up-guidelines">Clean up guidelines</a><ul>
<li><a class="reference internal" href="#additional-suggestions">Additional suggestions</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#backward-compatibility">Backward compatibility</a></li>
<li><a class="reference internal" href="#alternatives">Alternatives</a><ul>
<li><a class="reference internal" href="#tags">Tags</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../../contents.html">Documentation overview</a><ul>
<li><a href="../index.html">The Matplotlib Developers’ Guide</a><ul>
<li><a href="index.html">Matplotlib Enhancement Proposals</a><ul>
<li>Previous: <a href="MEP11.html" title="previous chapter">MEP11: Third-party dependencies</a></li>
<li>Next: <a href="MEP13.html" title="next chapter">MEP13: Use properties for Artists</a></li>
</ul></li>
</ul></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/devel/MEP/MEP12.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="mep12-improve-gallery-and-examples">
<h1>MEP12: Improve Gallery and Examples<a class="headerlink" href="#mep12-improve-gallery-and-examples" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#status" id="id9">Status</a></li>
<li><a class="reference internal" href="#branches-and-pull-requests" id="id10">Branches and Pull requests</a></li>
<li><a class="reference internal" href="#abstract" id="id11">Abstract</a></li>
<li><a class="reference internal" href="#detailed-description" id="id12">Detailed description</a></li>
<li><a class="reference internal" href="#implementation" id="id13">Implementation</a><ul>
<li><a class="reference internal" href="#gallery-sections" id="id14">Gallery sections</a></li>
<li><a class="reference internal" href="#clean-up-guidelines" id="id15">Clean up guidelines</a><ul>
<li><a class="reference internal" href="#additional-suggestions" id="id16">Additional suggestions</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#backward-compatibility" id="id17">Backward compatibility</a></li>
<li><a class="reference internal" href="#alternatives" id="id18">Alternatives</a><ul>
<li><a class="reference internal" href="#tags" id="id19">Tags</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="status">
<h2><a class="toc-backref" href="#id9">Status</a><a class="headerlink" href="#status" title="Permalink to this headline">¶</a></h2>
<p><strong>Progress</strong></p>
<p>Initial changes added in 1.3. Conversion of the gallery is on-going.
29 September 2015 - The last <code class="xref py py-obj docutils literal"><span class="pre">pylab_examples</span></code> where <code class="xref py py-obj docutils literal"><span class="pre">pylab</span></code> is imported has been converted over to use <code class="xref py py-obj docutils literal"><span class="pre">matplotlib</span> <span class="pre">pyplot</span></code> and <code class="xref py py-obj docutils literal"><span class="pre">numpy</span></code>.</p>
</div>
<div class="section" id="branches-and-pull-requests">
<h2><a class="toc-backref" href="#id10">Branches and Pull requests</a><a class="headerlink" href="#branches-and-pull-requests" title="Permalink to this headline">¶</a></h2>
<p>#1623, #1924, #2181</p>
<p>PR <code class="xref py py-obj docutils literal"><span class="pre">#2474</span> <span class="pre"><https://github.com/matplotlib/matplotlib/pull/2474</span></code>>_
demonstrates a single example being cleaned up and moved to the
appropriate section.</p>
</div>
<div class="section" id="abstract">
<h2><a class="toc-backref" href="#id11">Abstract</a><a class="headerlink" href="#abstract" title="Permalink to this headline">¶</a></h2>
<p>Reorganizing the matplotlib plot gallery would greatly simplify
navigation of the gallery. In addition, examples should be cleaned-up
and simplified for clarity.</p>
</div>
<div class="section" id="detailed-description">
<h2><a class="toc-backref" href="#id12">Detailed description</a><a class="headerlink" href="#detailed-description" title="Permalink to this headline">¶</a></h2>
<p>The matplotlib gallery was recently set up to split examples up into
sections. As discussed in that PR <a class="footnote-reference" href="#id4" id="id1">[1]</a>, the current example sections
(<code class="docutils literal"><span class="pre">api</span></code>, <code class="docutils literal"><span class="pre">pylab_examples</span></code>) aren’t terribly useful to users: New
sections in the gallery would help users find relevant examples.</p>
<p>These sections would also guide a cleanup of the examples: Initially,
all the current examples would remain and be listed under their
current directories. Over time, these examples could be cleaned up
and moved into one of the new sections.</p>
<p>This process allows users to easily identify examples that need to be
cleaned up; i.e. anything in the <code class="docutils literal"><span class="pre">api</span></code> and <code class="docutils literal"><span class="pre">pylab_examples</span></code>
directories.</p>
</div>
<div class="section" id="implementation">
<h2><a class="toc-backref" href="#id13">Implementation</a><a class="headerlink" href="#implementation" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Create new gallery sections. [Done]</li>
<li>Clean up examples and move them to the new gallery sections (over the course
of many PRs and with the help of many users/developers). [In progress]</li>
</ol>
<div class="section" id="gallery-sections">
<h3><a class="toc-backref" href="#id14">Gallery sections</a><a class="headerlink" href="#gallery-sections" title="Permalink to this headline">¶</a></h3>
<p>The naming of sections is critical and will guide the clean-up
effort. The current sections are:</p>
<ul class="simple">
<li>Lines, bars, and markers (more-or-less 1D data)</li>
<li>Shapes and collections</li>
<li>Statistical plots</li>
<li>Images, contours, and fields</li>
<li>Pie and polar charts: Round things</li>
<li>Color</li>
<li>Text, labels, and annotations</li>
<li>Ticks and spines</li>
<li>Subplots, axes, and figures</li>
<li>Specialty plots (e.g., sankey, radar, tornado)</li>
<li>Showcase (plots with tweaks to make them publication-quality)</li>
<li>separate sections for toolboxes (already exists: ‘mplot3d’,
‘axes_grid’, ‘units’, ‘widgets’)</li>
</ul>
<p>These names are certainly up for debate. As these sections grow, we
should reevaluate them and split them up as necessary.</p>
</div>
<div class="section" id="clean-up-guidelines">
<h3><a class="toc-backref" href="#id15">Clean up guidelines</a><a class="headerlink" href="#clean-up-guidelines" title="Permalink to this headline">¶</a></h3>
<p>The current examples in the <code class="docutils literal"><span class="pre">api</span></code> and <code class="docutils literal"><span class="pre">pylab_examples</span></code> sections of
the gallery would remain in those directories until they are cleaned
up. After clean-up, they would be moved to one of the new gallery
sections described above. “Clean-up” should involve:</p>
<ul>
<li><p class="first"><a class="reference external" href="https://www.python.org/dev/peps/pep-0008/">PEP8</a> clean-ups (running <a class="reference external" href="https://pypi.python.org/pypi/flake8">flake8</a>, or a similar checker, is
highly recommended)</p>
</li>
<li><p class="first">Commented-out code should be removed.</p>
</li>
<li><p class="first">Add introductory sentence or paragraph in the main docstring. See
<a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/6d1b8a2ef277091eb718690e4443e6fa30cbc488">6d1b8a2</a>.</p>
</li>
<li><p class="first">Replace uses of <code class="docutils literal"><span class="pre">pylab</span></code> interface with <code class="docutils literal"><span class="pre">pyplot</span></code> (+ <code class="docutils literal"><span class="pre">numpy</span></code>,
etc.). See <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/c25ef1e02b3a0ecb279492409dac0de9b3d2c0e2">c25ef1e</a></p>
</li>
<li><p class="first">Remove shebang line, e.g.:</p>
<blockquote>
<div><p>#!/usr/bin/env python</p>
</div></blockquote>
</li>
<li><p class="first">Use consistent imports. In particular:</p>
<blockquote>
<div><p>import numpy as np</p>
<p>import matplotlib.pyplot as plt</p>
</div></blockquote>
<p>Avoid importing specific functions from these modules (e.g. <code class="docutils literal"><span class="pre">from</span>
<span class="pre">numpy</span> <span class="pre">import</span> <span class="pre">sin</span></code>)</p>
</li>
<li><p class="first">Each example should focus on a specific feature (excluding
<code class="docutils literal"><span class="pre">showcase</span></code> examples, which will show more “polished”
plots). Tweaking unrelated to that feature should be removed. See
<a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/f7b2217a1f92343e8aca0684d19c9915cc2e8674">f7b2217</a>,
<a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/e57b5fc31fbad83ed9c43c77ef15368efdcb9ec1">e57b5fc</a>,
and <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/1458aa87c5eae9dd99e141956a6adf7a0f3c6707">1458aa8</a></p>
</li>
</ul>
<p>Use of <code class="docutils literal"><span class="pre">pylab</span></code> should be demonstrated/discussed on a dedicated help
page instead of the gallery examples.</p>
<p><strong>Note:</strong> When moving an existing example, you should search for
references to that example. For example, the API documentation for
<code class="xref py py-obj docutils literal"><span class="pre">axes.py</span></code> and <code class="xref py py-obj docutils literal"><span class="pre">pyplot.py</span></code> may use these examples to generate
plots. Use your favorite search tool (e.g., grep, ack, <a class="reference external" href="https://pypi.python.org/pypi/grin">grin</a>, <a class="reference external" href="https://pypi.python.org/pypi/pss">pss</a>) to search the matplotlib
package. See <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/2dc9a4651e5e566afc0866c603aa8d06aaf32b71">2dc9a46</a>
and <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/aa6b410f9fa085ccf5f4f962a6f26af5beeae7af">aa6b410</a></p>
<div class="section" id="additional-suggestions">
<h4><a class="toc-backref" href="#id16">Additional suggestions</a><a class="headerlink" href="#additional-suggestions" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Provide links (both ways) between examples and API docs for the
methods/objects used. (issue <a class="reference external" href="https://github.com/matplotlib/matplotlib/issues/2222">#2222</a>)</li>
<li>Use <code class="docutils literal"><span class="pre">plt.subplots</span></code> (note trailing “s”) in preference over
<code class="docutils literal"><span class="pre">plt.subplot</span></code>.</li>
<li>Rename the example to clarify it’s purpose. For example, the most
basic demo of <code class="docutils literal"><span class="pre">imshow</span></code> might be <code class="docutils literal"><span class="pre">imshow_demo.py</span></code>, and one
demonstrating different interpolation settings would be
<code class="docutils literal"><span class="pre">imshow_demo_interpolation.py</span></code> (<em>not</em> <code class="docutils literal"><span class="pre">imshow_demo2.py</span></code>).</li>
<li>Split up examples that try to do too much. See <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/509967518ce5ce5ba31edf12486ffaa344e748f2">5099675</a>
and <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/fc2ab07cc586abba4c024d8c0d841c4357a3936f">fc2ab07</a></li>
<li>Delete examples that don’t show anything new.</li>
<li>Some examples exercise esoteric features for unit testing. These
tweaks should be moved out of the gallery to an example in the
<code class="docutils literal"><span class="pre">unit</span></code> directory located in the root directory of the package.</li>
<li>Add plot titles to clarify intent of the example. See <a class="reference external" href="https://github.com/tonysyu/matplotlib/commit/bd2b13c54bf4aa2058781b9a805d68f2feab5ba5">bd2b13c</a></li>
</ul>
</div>
</div>
</div>
<div class="section" id="backward-compatibility">
<h2><a class="toc-backref" href="#id17">Backward compatibility</a><a class="headerlink" href="#backward-compatibility" title="Permalink to this headline">¶</a></h2>
<p>The website for each Matplotlib version is readily accessible, so
users who want to refer to old examples can still do so.</p>
</div>
<div class="section" id="alternatives">
<h2><a class="toc-backref" href="#id18">Alternatives</a><a class="headerlink" href="#alternatives" title="Permalink to this headline">¶</a></h2>
<div class="section" id="tags">
<h3><a class="toc-backref" href="#id19">Tags</a><a class="headerlink" href="#tags" title="Permalink to this headline">¶</a></h3>
<p>Tagging examples will also help users search the example gallery. Although tags
would be a big win for users with specific goals, the plot gallery will remain
the entry point to these examples, and sections could really help users
navigate the gallery. Thus, tags are complementary to this reorganization.</p>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><a class="reference external" href="https://github.com/matplotlib/matplotlib/pull/714">https://github.com/matplotlib/matplotlib/pull/714</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[2]</td><td><a class="reference external" href="https://github.com/matplotlib/matplotlib/issues/524">https://github.com/matplotlib/matplotlib/issues/524</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[3]</td><td><a class="reference external" href="http://matplotlib.1069221.n5.nabble.com/Matplotlib-gallery-td762.html#a33379091">http://matplotlib.1069221.n5.nabble.com/Matplotlib-gallery-td762.html#a33379091</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[4]</td><td><a class="reference external" href="http://www.labri.fr/perso/nrougier/teaching/matplotlib/">http://www.labri.fr/perso/nrougier/teaching/matplotlib/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[5]</td><td><a class="reference external" href="http://www.labri.fr/perso/nrougier/coding/gallery/">http://www.labri.fr/perso/nrougier/coding/gallery/</a></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team.
Last updated on May 10, 2017.
Created using <a
href="http://sphinx-doc.org/">Sphinx</a> 1.5.5.
</div>
</body>
<footer>
</footer>
</html>