seaborn.set_color_codes

  1. seaborn.set_color_codes(palette='deep')

Change how matplotlib color shorthands are interpreted.

Calling this will change how shorthand codes like “b” or “g” are interpreted by matplotlib in subsequent plots.

参数:palette:{deep, muted, pastel, dark, bright, colorblind}

Named seaborn palette to use as the source of colors.

See also

Color codes can be set through the high-level seaborn style manager.Color codes can also be set through the function that sets the matplotlib color cycle.

Examples

Map matplotlib color codes to the default seaborn palette.

  1. >>> import matplotlib.pyplot as plt
  2. >>> import seaborn as sns; sns.set()
  3. >>> sns.set_color_codes()
  4. >>> _ = plt.plot([0, 1], color="r")

http://seaborn.pydata.org/_images/seaborn-set_color_codes-1.png

Use a different seaborn palette.

  1. >>> sns.set_color_codes("dark")
  2. >>> _ = plt.plot([0, 1], color="g")
  3. >>> _ = plt.plot([0, 2], color="m")

http://seaborn.pydata.org/_images/seaborn-set_color_codes-2.png