Skip to content

Commit 1a3b32f

Browse files
committed
tag guideline draft
1 parent a99673c commit 1a3b32f

File tree

3 files changed

+226
-0
lines changed

3 files changed

+226
-0
lines changed

doc/devel/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Policies and guidelines
146146

147147
document
148148
style_guide
149+
../gallery/tag_guidelines
149150

150151
.. grid-item-card::
151152
:shadow: none

galleries/examples/tag_glossary.rst

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
:orphan:
2+
3+
Tag Glossary
4+
============
5+
6+
I. API tags: what content from the API reference is in the example?
7+
II. Structural tags: what format is the example? What context can we provide?
8+
III. Domain tags: what discipline(s) might seek this example consistently?
9+
IV. Internal tags: what information is helpful for maintainers or contributors?
10+
11+
12+
*1. API tags: what content from the API reference is in the example?*
13+
14+
+-----------------------------------+---------------------------------------------+
15+
|``tag`` | use case - if not obvious |
16+
+===================================+=============================================+
17+
|**Styling** |
18+
+-----------------------------------+---------------------------------------------+
19+
|``styling: color`` | |
20+
+-----------------------------------+---------------------------------------------+
21+
|``styling: shape`` | |
22+
+-----------------------------------+---------------------------------------------+
23+
|``styling: size`` | |
24+
+-----------------------------------+---------------------------------------------+
25+
|``styling: position`` | |
26+
+-----------------------------------+---------------------------------------------+
27+
|``styling: texture`` | |
28+
+-----------------------------------+---------------------------------------------+
29+
|``styling: colormap`` | |
30+
+-----------------------------------+---------------------------------------------+
31+
|``styling: colorbar`` | |
32+
+-----------------------------------+---------------------------------------------+
33+
|``styling: linestyle`` | |
34+
+-----------------------------------+---------------------------------------------+
35+
|``styling: small-multiples`` | |
36+
+-----------------------------------+---------------------------------------------+
37+
| | |
38+
+-----------------------------------+---------------------------------------------+
39+
|**Primary or relevant plot component** |
40+
+-----------------------------------+---------------------------------------------+
41+
|Use these tags when plot contains a teachable example |
42+
+-----------------------------------+---------------------------------------------+
43+
|``component: axes`` | |
44+
+-----------------------------------+---------------------------------------------+
45+
|``component: axis`` | |
46+
+-----------------------------------+---------------------------------------------+
47+
|``component: marker`` | |
48+
+-----------------------------------+---------------------------------------------+
49+
|``component: label`` | |
50+
+-----------------------------------+---------------------------------------------+
51+
|``component: title`` | |
52+
+-----------------------------------+---------------------------------------------+
53+
|``component: legend`` | |
54+
+-----------------------------------+---------------------------------------------+
55+
|``component: subplot`` | |
56+
+-----------------------------------+---------------------------------------------+
57+
|``component: figure`` | |
58+
+-----------------------------------+---------------------------------------------+
59+
|``component: annotation`` | |
60+
+-----------------------------------+---------------------------------------------+
61+
|``component: label`` | |
62+
+-----------------------------------+---------------------------------------------+
63+
|``component: ticks`` | |
64+
+-----------------------------------+---------------------------------------------+
65+
|``component: spines`` |frequently paired with ``component: axis`` |
66+
+-----------------------------------+---------------------------------------------+
67+
|``component: error`` | |
68+
+-----------------------------------+---------------------------------------------+
69+
| | |
70+
+-----------------------------------+---------------------------------------------+
71+
|**Interactivity** |
72+
+-----------------------------------+---------------------------------------------+
73+
|``interactivity: event handling`` | |
74+
+-----------------------------------+---------------------------------------------+
75+
|``interactivity: zoom`` | |
76+
+-----------------------------------+---------------------------------------------+
77+
|``interactivity: pan`` | |
78+
+-----------------------------------+---------------------------------------------+
79+
|``interactivity: brush`` | |
80+
+-----------------------------------+---------------------------------------------+
81+
| | |
82+
+-----------------------------------+---------------------------------------------+
83+
|**Plot Type** |
84+
+-----------------------------------+---------------------------------------------+
85+
|``plot type: bar`` |example contains a bar plot |
86+
+-----------------------------------+---------------------------------------------+
87+
|``plot type: line`` |example contains a line plot |
88+
+-----------------------------------+---------------------------------------------+
89+
|``plot type: pie`` |example contains a pie plot |
90+
+-----------------------------------+---------------------------------------------+
91+
|``plot type: polar`` |example contains a polar plot |
92+
+-----------------------------------+---------------------------------------------+
93+
|``plot type: 3D`` |example contains a 3D plot |
94+
+-----------------------------------+---------------------------------------------+
95+
|``plot type: histogram`` |example contains a histogram |
96+
+-----------------------------------+---------------------------------------------+
97+
|``plot type: specialty`` | |
98+
+-----------------------------------+---------------------------------------------+
99+
|``plot type: `` | |
100+
+-----------------------------------+---------------------------------------------+
101+
102+
103+
*2. Structural tags: what format is the example? What context can we provide?*
104+
105+
+-----------------------+-------------------------------------------------------------------+
106+
|``tag`` | use case |
107+
+=======================+===================================================================+
108+
|``level: reference`` |reference docs like "marker reference" or "list of named colors" |
109+
| | - dense collection of short-format information |
110+
| | - well-defined scope, accessible information |
111+
+-----------------------+-------------------------------------------------------------------+
112+
|``level`` |level refers to how much context/background the user will need |
113+
+-----------------------+-------------------------------------------------------------------+
114+
|``level: beginner`` |concepts are standalone, self-contained, require only one module |
115+
+-----------------------+-------------------------------------------------------------------+
116+
|``level: intermediate``|concepts may require knowledge of other modules, have dependencies |
117+
+-----------------------+-------------------------------------------------------------------+
118+
|``level: advanced`` |concepts require multiple modules and have dependencies |
119+
+-----------------------+-------------------------------------------------------------------+
120+
121+
*3. Domain tags: what discipline(s) might seek this example consistently?*
122+
123+
Note: it's futile to draw fences around "who owns what", and that's not the point of domain tags. Domain tags help groups of people to privately organize relevant information, and so are not displayed publicly. See below for a list of existing domain tags. If you don't see the one you're looking for and you think it should exist, consider proposing it.
124+
125+
+-------------------------------+----------------------------------------+
126+
|``tag`` | use case |
127+
+=======================+================================================+
128+
|``domain`` |for whom is the example relevant? |
129+
+-------------------------------+----------------------------------------+
130+
|``domain: cartography`` | |
131+
+-------------------------------+----------------------------------------+
132+
|``domain: geometry`` | |
133+
+-------------------------------+----------------------------------------+
134+
|``domain: statistics`` | |
135+
+-------------------------------+----------------------------------------+
136+
|``domain: oceanography`` | |
137+
+-------------------------------+----------------------------------------+
138+
|``domain: signal-processing`` | |
139+
+-------------------------------+----------------------------------------+
140+
| | |
141+
+-------------------------------+----------------------------------------+
142+
143+
*4. Internal tags: what information is helpful for maintainers or contributors?*
144+
145+
+---------------------------+-----------------------------------------------------------------------+
146+
|``tag`` | use case |
147+
+===========================+=======================================================================+
148+
|``internal: low bandwidth``|allows users to filter out bandwidth-intensive examples like animations|
149+
+---------------------------+-----------------------------------------------------------------------+
150+
|``internal: untagged`` |allows docs contributors to easily find untagged examples |
151+
+---------------------------+-----------------------------------------------------------------------+
152+
|``internal: deprecated`` |examples containing deprecated functionality or concepts |
153+
+---------------------------+-----------------------------------------------------------------------+
154+
|``internal: needs-review`` |example needs to be reviewed for accuracy or pedagogical value |
155+
+---------------------------+-----------------------------------------------------------------------+

galleries/examples/tag_guidelines.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Guidelines for assigning tags to gallery examples
2+
=================================================
3+
4+
*Why do we need tags?*
5+
6+
Tags serve multiple purposes.
7+
8+
Tags have a one-to-many organization (i.e. one example can have several tags), while the gallery structure requires that examples are placed in only one location. This means tags provide a secondary layer of organization and make the gallery of examples more flexible and more user-friendly.
9+
10+
They allow for better discoverability, search, and browse functions. They are helpful for users struggling to write a search query for what they're looking for.
11+
12+
Hidden tags provide additional functionality for maintainers and contributors.
13+
14+
*What gets a tag?*
15+
16+
Every gallery example should be tagged with:
17+
18+
* 1+ content tags
19+
* structural, domain, or internal tag(s) if helpful
20+
21+
Examples with many tags may indicate that the entry is a showcase example.
22+
23+
Tags can repeat existing forms of organization (e.g. an example is in the Animation folder and also gets an ``animation`` tag).
24+
25+
Tags are helpful to denote particularly good "byproduct" examples. E.g. the explicit purpose of a gallery example might be to demonstrate a colormap, but it's also a good demonstration of a legend. Tag ``legend`` to indicate that, rather than changing the title or the scope of the example.
26+
27+
*Tag Categories* - See :doc:`Tag Glossary <tag_glossary>` for a complete list of tags.
28+
29+
I. API tags: what content from the API reference is in the example?
30+
II. Structural tags: what format is the example? What context can we provide?
31+
III. Domain tags: what discipline(s) might seek this example consistently?
32+
IV. Internal tags: what information is helpful for maintainers or contributors?
33+
34+
*Proposing new tags*
35+
36+
1. Review existing tag list, looking out for similar entries (i.e. ``axes`` and ``axis``).
37+
2. If a relevant tag or subcategory does not yet exist, propose it. Each tag is two parts: ``subcategory: tag``. Tags should be one or two words.
38+
3. New tags should be be added when they are relevant to existing gallery entries too. Avoid tags that will link to only a single gallery entry.
39+
4. Tags can recreate other forms of organization.
40+
41+
Note: Tagging organization aims to work for 80-90% of cases. Some examples fall outside of the tagging structure. Niche or specific examples shouldn't be given standalone tags that won't apply to other examples.
42+
43+
*How to tag?*
44+
where you put the directive is where the tag will show
45+
46+
**Related content**
47+
48+
*What is a gallery example?*
49+
50+
The gallery of examples contains visual demonstrations of matplolib features. Gallery examples exist so that users can scan through visual examples.
51+
52+
Unlike tutorials or user guides, gallery examples teach by demonstration, rather than by explanation or instruction.
53+
54+
Gallery examples should avoid instruction or excessive explanation except for brief clarifying code comments. Instead, they can tag related concepts and/or link to relevant tutorials or user guides.
55+
56+
Format:
57+
58+
All gallery examples should aim to follow the following format:
59+
60+
* Title: 1-6 words, descriptive of content
61+
* Subtitle: 10-50 words, action-oriented description of the example subject
62+
* Image: a clear demonstration of the subject, showing edge cases and different applications if possible
63+
* Code + Text (optional): code, commented as appropriate + written text to add context if necessary
64+
65+
Example:
66+
67+
``bbox_intersect`` gallery example showcases the point of visual examples
68+
69+
* messy example/ hard to categorize, but the gallery is definitely the right spot for it because it's the kind of thing you'd find by visual search
70+
* https://matplotlib.org/devdocs/gallery/misc/bbox_intersect.html#sphx-glr-gallery-misc-bbox-intersect-py

0 commit comments

Comments
 (0)