|
1 | | -Guidelines for assigning tags to gallery examples |
2 | | -================================================= |
| 1 | +Tagging guidelines |
| 2 | +================== |
3 | 3 |
|
4 | 4 | Why do we need tags? |
5 | 5 | -------------------- |
6 | 6 |
|
7 | 7 | Tags serve multiple purposes. |
8 | 8 |
|
9 | | -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 | +Tags have a one-to-many organization (i.e. one example can have several tags), while |
| 10 | +the gallery structure requires that examples are placed in only one location. This means |
| 11 | +tags provide a secondary layer of organization and make the gallery of examples more |
| 12 | +flexible and more user-friendly. |
10 | 13 |
|
11 | | -They allow for better discoverability, search, and browse functionality. They are helpful for users struggling to write a search query for what they're looking for. |
| 14 | +They allow for better discoverability, search, and browse functionality. They are |
| 15 | +helpful for users struggling to write a search query for what they're looking for. |
12 | 16 |
|
13 | 17 | Hidden tags provide additional functionality for maintainers and contributors. |
14 | 18 |
|
| 19 | +How to tag? |
| 20 | +----------- |
| 21 | +Place the tag directive at the bottom of each page and add the tags underneath:: |
| 22 | + |
| 23 | + # fig, ax = plt.subplots() |
| 24 | + # ax.plot([1,2,3], [3,2,1], linestyle=':') |
| 25 | + # |
| 26 | + # .. tags:: |
| 27 | + # plot-type: line, styling: texture, |
| 28 | + |
| 29 | + |
15 | 30 | What gets a tag? |
16 | 31 | ---------------- |
17 | 32 |
|
@@ -20,56 +35,36 @@ Every gallery example should be tagged with: |
20 | 35 | * 1+ content tags |
21 | 36 | * structural, domain, or internal tag(s) if helpful |
22 | 37 |
|
23 | | -Tags can repeat existing forms of organization (e.g. an example is in the Animation folder and also gets an ``animation`` tag). |
| 38 | +Tags can repeat existing forms of organization (e.g. an example is in the Animation |
| 39 | +folder and also gets an ``animation`` tag). |
| 40 | + |
| 41 | +Tags are helpful to denote particularly good "byproduct" examples. E.g. the explicit |
| 42 | +purpose of a gallery example might be to demonstrate a colormap, but it's also a good |
| 43 | +demonstration of a legend. Tag ``legend`` to indicate that, rather than changing the |
| 44 | +title or the scope of the example. |
24 | 45 |
|
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. |
| 46 | +.. card:: |
26 | 47 |
|
27 | | -**Tag Categories** - See :doc:`Tag Glossary <tag_glossary>` for a complete list of tags. |
| 48 | + **Tag Categories** |
| 49 | + ^^^ |
| 50 | + .. rst-class:: section-toc |
28 | 51 |
|
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? |
| 52 | + .. toctree:: |
| 53 | + :maxdepth: 2 |
| 54 | + |
| 55 | + tag_glossary |
| 56 | + |
| 57 | + +++ |
| 58 | + See :doc:`Tag Glossary <tag_glossary>` for a complete list |
33 | 59 |
|
34 | 60 | Proposing new tags |
35 | 61 | ------------------ |
36 | 62 |
|
37 | 63 | 1. Review existing tag list, looking out for similar entries (i.e. ``axes`` and ``axis``). |
38 | | -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. |
39 | | -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. |
| 64 | +2. If a relevant tag or subcategory does not yet exist, propose it. Each tag is two |
| 65 | + parts: ``subcategory: tag``. Tags should be one or two words. |
| 66 | +3. New tags should be be added when they are relevant to existing gallery entries too. |
| 67 | + Avoid tags that will link to only a single gallery entry. |
40 | 68 | 4. Tags can recreate other forms of organization. |
41 | 69 |
|
42 | | -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. |
43 | | - |
44 | | -How to tag? |
45 | | ------------ |
46 | | -Put each tag as a directive at the bottom of the page. |
47 | | - |
48 | | -Related content |
49 | | ---------------- |
50 | | - |
51 | | -What is a gallery example? |
52 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^ |
53 | | - |
54 | | -The gallery of examples contains visual demonstrations of matplotlib features. Gallery examples exist so that users can scan through visual examples. |
55 | | - |
56 | | -Unlike tutorials or user guides, gallery examples teach by demonstration, rather than by explanation or instruction. |
57 | | - |
58 | | -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. |
59 | | - |
60 | | -Format |
61 | | -^^^^^^ |
62 | | - |
63 | | -All :ref:`examples-index` should aim to follow the following format: |
64 | | - |
65 | | -* Title: 1-6 words, descriptive of content |
66 | | -* Subtitle: 10-50 words, action-oriented description of the example subject |
67 | | -* Image: a clear demonstration of the subject, showing edge cases and different applications if possible |
68 | | -* Code + Text (optional): code, commented as appropriate + written text to add context if necessary |
69 | | - |
70 | | -Example: |
71 | | - |
72 | | -The ``bbox_intersect`` gallery example demonstrates the point of visual examples: |
73 | | - |
74 | | -* this example is "messy" in that it's hard to categorize, but the gallery is the right spot for it because it makes sense to find it by visual search |
75 | | -* https://matplotlib.org/devdocs/gallery/misc/bbox_intersect.html#sphx-glr-gallery-misc-bbox-intersect-py |
| 70 | +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. |