X Tutup
Skip to content

Seaborn style sheets don't edit patch.facecolor #6307

@egpbos

Description

@egpbos

This is relevant e.g. when using ax.arrow to plot arrows. The color of the heads when using Seaborn is modified to the first color in the current color scheme.

import matplotlib as mpl
import seaborn.apionly as sns

with mpl.style.context(['seaborn-deep']):
    print(mpl.rcParams['patch.facecolor'])  # here the color is still at its default value ('b')

sns.set(context='paper', style='darkgrid')
print(mpl.rcParams['patch.facecolor'])  # now Seaborn has set the patch color to the first color in the default palette

print(sns.color_palette()[0])  # this is that color

with sns.color_palette('hls'):
    print(mpl.rcParams['patch.facecolor'])  # patch is now red, the first color in the hls palette

Outputs:

b
(0.2980392156862745, 0.4470588235294118, 0.6901960784313725)
(0.2980392156862745, 0.4470588235294118, 0.6901960784313725)
(0.86, 0.37119999999999997, 0.33999999999999997)

This is probably platform independent, but for completeness' sake: for me it works like this on Linux (Ubuntu 15.10) and OSX (10.9.5), with Matplotlib 1.5.1 and Seaborn 0.7.0 in Python 2.7.6. Matplotlib and Seaborn were installed with pip on Linux and with Enthought Canopy on OSX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup