Skip to content

Commit 8ad8ccd

Browse files
committed
DOC: Better doc of colors
1 parent 925b27f commit 8ad8ccd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

examples/color/named_colors.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
* the :doc:`/tutorials/colors/colors` tutorial;
1313
* the `matplotlib.colors` API;
1414
* the :doc:`/gallery/color/color_demo`.
15+
16+
.. contents::
17+
18+
----------------------------
19+
Helper Function for Plotting
20+
----------------------------
21+
First we define a helper function for making a table of colors, then we use it
22+
on some common color categories.
1523
"""
1624

1725
from matplotlib.patches import Rectangle
@@ -73,11 +81,27 @@ def plot_colortable(colors, title, sort_colors=True, emptycols=0):
7381

7482
return fig
7583

84+
#############################################################################
85+
# -----------
86+
# Base colors
87+
# -----------
88+
7689
plot_colortable(mcolors.BASE_COLORS, "Base Colors",
7790
sort_colors=False, emptycols=1)
91+
92+
#############################################################################
93+
# ---------------
94+
# Tableau Palette
95+
# ---------------
96+
7897
plot_colortable(mcolors.TABLEAU_COLORS, "Tableau Palette",
7998
sort_colors=False, emptycols=2)
8099

100+
#############################################################################
101+
# ----------
102+
# CSS Colors
103+
# ----------
104+
81105
# sphinx_gallery_thumbnail_number = 3
82106
plot_colortable(mcolors.CSS4_COLORS, "CSS Colors")
83107

0 commit comments

Comments
 (0)