Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
990 lines (282 sloc) 14.7 KB

Colors and Style

Yellowbrick believes that visual diagnostics are more effective if visualizations are appealing. As a result, we have borrowed familiar styles from Seaborn and use the new matplotlib 2.0 styles. We hope that these out-of-the-box styles will make your visualizations publication ready, though you can also still customize your own look and feel by directly modifying the visualizations with matplotlib.

For most visualizers, Yellowbrick prioritizes color in its visualizations. There are two types of color sets that can be provided to a visualizer: a palette and a sequence. Palettes are discrete color values usually of a fixed length and are typically used for classification or clustering by showing each class, cluster, or topic. Sequences are continuous color values that do not have a fixed length but rather a range and are typically used for regression or clustering, showing all possible values in the target or distances between items in clusters.

In order to make the distinction easy, most matplotlib colors (both palettes and sequences) can be referred to by name. A complete listing can be imported as follows:

import matplotlib.pyplot as plt
from yellowbrick.style.palettes import PALETTES, SEQUENCES, color_palette

Palettes and sequences can be passed to visualizers as follows:

visualizer = Visualizer(color="bold")

Refer to the API listing of each visualizer for specifications on how the color argument is handled. In the next two sections, we will show every possible color palette and sequence currently available in Yellowbrick.

Color Palettes

Color palettes are discrete color lists that have a fixed length. The most common palettes are ordered as "blue", "green", "red", "maroon", "yellow", "cyan", and an optional "key". This allows you to specify these named colors by the first character, e.g. 'bgrmyck' for matplotlib visualizations.

To change the global color palette, use the set_palette function as follows:

from yellowbrick.style import set_palette
set_palette('flatui')

Color palettes are most often used for classifiers to show the relationship between discrete class labels. They can also be used for clustering algorithms to show membership in discrete clusters.

A complete listing of the Yellowbrick color palettes can be visualized as follows:

# ['blue', 'green', 'red', 'maroon', 'yellow', 'cyan']
for palette in PALETTES.keys():
    color_palette(palette).plot()
    plt.title(palette, loc='left')

images/palettes/palettes_2_0.png

images/palettes/palettes_2_1.png

images/palettes/palettes_2_2.png

images/palettes/palettes_2_3.png

images/palettes/palettes_2_4.png

images/palettes/palettes_2_5.png

images/palettes/palettes_2_6.png

images/palettes/palettes_2_7.png

images/palettes/palettes_2_8.png

images/palettes/palettes_2_9.png

images/palettes/palettes_2_10.png

images/palettes/palettes_2_11.png

images/palettes/palettes_2_12.png

images/palettes/palettes_2_13.png

images/palettes/palettes_2_14.png

images/palettes/palettes_2_15.png

images/palettes/palettes_2_16.png

Color Sequences

Color sequences are continuous representations of color and are usually defined as a fixed number of steps between a minimum and maximal value. Sequences must be created with a total number of bins (or length) before plotting to ensure that the values are assigned correctly. In the listing below, each sequence is shown with varying lengths to describe the range of colors in detail.

Color sequences are most often used in regressions to show the distribution in the range of target values. They can also be used in clustering and distribution analysis to show distance or histogram data.

Below is a complete listing of all the sequence names available in Yellowbrick:

for name, maps in SEQUENCES.items():
    for num, palette in maps.items():
        color_palette(palette).plot()
        plt.title("{} - {}".format(name, num), loc='left')

images/palettes/palettes_3_1.png

images/palettes/palettes_3_2.png

images/palettes/palettes_3_3.png

images/palettes/palettes_3_4.png

images/palettes/palettes_3_5.png

images/palettes/palettes_3_6.png

images/palettes/palettes_3_7.png

images/palettes/palettes_3_8.png

images/palettes/palettes_3_9.png

images/palettes/palettes_3_10.png

images/palettes/palettes_3_11.png

images/palettes/palettes_3_12.png

images/palettes/palettes_3_13.png

images/palettes/palettes_3_14.png

images/palettes/palettes_3_15.png

images/palettes/palettes_3_16.png

images/palettes/palettes_3_17.png

images/palettes/palettes_3_18.png

images/palettes/palettes_3_19.png

images/palettes/palettes_3_20.png

images/palettes/palettes_3_21.png

images/palettes/palettes_3_22.png

images/palettes/palettes_3_23.png

images/palettes/palettes_3_24.png

images/palettes/palettes_3_25.png

images/palettes/palettes_3_26.png

images/palettes/palettes_3_27.png

images/palettes/palettes_3_28.png

images/palettes/palettes_3_29.png

images/palettes/palettes_3_30.png

images/palettes/palettes_3_31.png

images/palettes/palettes_3_32.png

images/palettes/palettes_3_33.png

images/palettes/palettes_3_34.png

images/palettes/palettes_3_35.png

images/palettes/palettes_3_36.png

images/palettes/palettes_3_37.png

images/palettes/palettes_3_38.png

images/palettes/palettes_3_39.png

images/palettes/palettes_3_40.png

images/palettes/palettes_3_41.png

images/palettes/palettes_3_42.png

images/palettes/palettes_3_43.png

images/palettes/palettes_3_44.png

images/palettes/palettes_3_45.png

images/palettes/palettes_3_46.png

images/palettes/palettes_3_47.png

images/palettes/palettes_3_48.png

images/palettes/palettes_3_49.png

images/palettes/palettes_3_50.png

images/palettes/palettes_3_51.png

images/palettes/palettes_3_52.png

images/palettes/palettes_3_53.png

images/palettes/palettes_3_54.png

images/palettes/palettes_3_55.png

images/palettes/palettes_3_56.png

images/palettes/palettes_3_57.png

images/palettes/palettes_3_58.png

images/palettes/palettes_3_59.png

images/palettes/palettes_3_60.png

images/palettes/palettes_3_61.png

images/palettes/palettes_3_62.png

images/palettes/palettes_3_63.png

images/palettes/palettes_3_64.png

images/palettes/palettes_3_65.png

images/palettes/palettes_3_66.png

images/palettes/palettes_3_67.png

images/palettes/palettes_3_68.png

images/palettes/palettes_3_69.png

images/palettes/palettes_3_70.png

images/palettes/palettes_3_71.png

images/palettes/palettes_3_72.png

images/palettes/palettes_3_73.png

images/palettes/palettes_3_74.png

images/palettes/palettes_3_75.png

images/palettes/palettes_3_76.png

images/palettes/palettes_3_77.png

images/palettes/palettes_3_78.png

images/palettes/palettes_3_79.png

images/palettes/palettes_3_80.png

images/palettes/palettes_3_81.png

images/palettes/palettes_3_82.png

images/palettes/palettes_3_83.png

images/palettes/palettes_3_84.png

images/palettes/palettes_3_85.png

images/palettes/palettes_3_86.png

images/palettes/palettes_3_87.png

images/palettes/palettes_3_88.png

images/palettes/palettes_3_89.png

images/palettes/palettes_3_90.png

images/palettes/palettes_3_91.png

images/palettes/palettes_3_92.png

images/palettes/palettes_3_93.png

images/palettes/palettes_3_94.png

images/palettes/palettes_3_95.png

images/palettes/palettes_3_96.png

images/palettes/palettes_3_97.png

images/palettes/palettes_3_98.png

images/palettes/palettes_3_99.png

images/palettes/palettes_3_100.png

images/palettes/palettes_3_101.png

images/palettes/palettes_3_102.png

images/palettes/palettes_3_103.png

images/palettes/palettes_3_104.png

images/palettes/palettes_3_105.png

images/palettes/palettes_3_106.png

images/palettes/palettes_3_107.png

images/palettes/palettes_3_108.png

images/palettes/palettes_3_109.png

images/palettes/palettes_3_110.png

images/palettes/palettes_3_111.png

images/palettes/palettes_3_112.png

images/palettes/palettes_3_113.png

images/palettes/palettes_3_114.png

images/palettes/palettes_3_115.png

images/palettes/palettes_3_116.png

images/palettes/palettes_3_117.png

images/palettes/palettes_3_118.png

images/palettes/palettes_3_119.png

images/palettes/palettes_3_120.png

images/palettes/palettes_3_121.png

images/palettes/palettes_3_122.png

images/palettes/palettes_3_123.png

images/palettes/palettes_3_124.png

images/palettes/palettes_3_125.png

images/palettes/palettes_3_126.png

images/palettes/palettes_3_127.png

images/palettes/palettes_3_128.png

images/palettes/palettes_3_129.png

images/palettes/palettes_3_130.png

images/palettes/palettes_3_131.png

images/palettes/palettes_3_132.png

images/palettes/palettes_3_133.png

images/palettes/palettes_3_134.png

images/palettes/palettes_3_135.png

images/palettes/palettes_3_136.png

images/palettes/palettes_3_137.png

images/palettes/palettes_3_138.png

images/palettes/palettes_3_139.png

images/palettes/palettes_3_140.png

images/palettes/palettes_3_141.png

images/palettes/palettes_3_142.png

images/palettes/palettes_3_143.png

images/palettes/palettes_3_144.png

images/palettes/palettes_3_145.png

images/palettes/palettes_3_146.png

images/palettes/palettes_3_147.png

images/palettes/palettes_3_148.png

images/palettes/palettes_3_149.png

images/palettes/palettes_3_150.png

images/palettes/palettes_3_151.png

images/palettes/palettes_3_152.png

images/palettes/palettes_3_153.png

images/palettes/palettes_3_154.png

images/palettes/palettes_3_155.png

images/palettes/palettes_3_156.png

images/palettes/palettes_3_157.png

images/palettes/palettes_3_158.png

images/palettes/palettes_3_159.png

images/palettes/palettes_3_160.png

images/palettes/palettes_3_161.png

images/palettes/palettes_3_162.png

images/palettes/palettes_3_163.png

images/palettes/palettes_3_164.png

images/palettes/palettes_3_165.png

images/palettes/palettes_3_166.png

images/palettes/palettes_3_167.png

images/palettes/palettes_3_168.png

images/palettes/palettes_3_169.png

images/palettes/palettes_3_170.png

images/palettes/palettes_3_171.png

images/palettes/palettes_3_172.png

images/palettes/palettes_3_173.png

images/palettes/palettes_3_174.png

images/palettes/palettes_3_175.png

images/palettes/palettes_3_176.png

images/palettes/palettes_3_177.png

images/palettes/palettes_3_178.png

images/palettes/palettes_3_179.png

images/palettes/palettes_3_180.png

images/palettes/palettes_3_181.png

images/palettes/palettes_3_182.png

images/palettes/palettes_3_183.png

images/palettes/palettes_3_184.png

images/palettes/palettes_3_185.png

images/palettes/palettes_3_186.png

images/palettes/palettes_3_187.png

images/palettes/palettes_3_188.png

images/palettes/palettes_3_189.png

images/palettes/palettes_3_190.png

images/palettes/palettes_3_191.png

images/palettes/palettes_3_192.png

images/palettes/palettes_3_193.png

images/palettes/palettes_3_194.png

images/palettes/palettes_3_195.png

images/palettes/palettes_3_196.png

images/palettes/palettes_3_197.png

images/palettes/palettes_3_198.png

images/palettes/palettes_3_199.png

images/palettes/palettes_3_200.png

images/palettes/palettes_3_201.png

images/palettes/palettes_3_202.png

images/palettes/palettes_3_203.png

images/palettes/palettes_3_204.png

images/palettes/palettes_3_205.png

images/palettes/palettes_3_206.png

images/palettes/palettes_3_207.png

images/palettes/palettes_3_208.png

API Reference

yellowbrick.style.colors module

.. automodule:: yellowbrick.style.colors
    :members:
    :undoc-members:
    :show-inheritance:

yellowbrick.style.palettes module

.. automodule:: yellowbrick.style.palettes
    :members:
    :undoc-members:
    :show-inheritance:

yellowbrick.style.rcmod module

.. automodule:: yellowbrick.style.rcmod
    :members:
    :undoc-members:
    :show-inheritance: