Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/color/named_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
* the :doc:`/tutorials/colors/colors` tutorial;
* the `matplotlib.colors` API;
* the :doc:`/gallery/color/color_demo`.

.. contents::

----------------------------
Helper Function for Plotting
----------------------------
First we define a helper function for making a table of colors, then we use it
on some common color categories.
"""

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

return fig

#############################################################################
# -----------
# Base colors
# -----------

plot_colortable(mcolors.BASE_COLORS, "Base Colors",
sort_colors=False, emptycols=1)

#############################################################################
# ---------------
# Tableau Palette
# ---------------

plot_colortable(mcolors.TABLEAU_COLORS, "Tableau Palette",
sort_colors=False, emptycols=2)

#############################################################################
# ----------
# CSS Colors
# ----------

# sphinx_gallery_thumbnail_number = 3
plot_colortable(mcolors.CSS4_COLORS, "CSS Colors")

Comment thread
story645 marked this conversation as resolved.
Outdated
Expand Down