Seaborn:指定确切的颜色

Jos*_*uaA 7 python matplotlib ipython-notebook seaborn

您可以为绘图指定颜色,但Seaborn会在绘图期间稍微将颜色静音.有没有办法关闭这种行为?

例:

import matplotlib
import seaborn as sns
import numpy as np

# Create some data
np.random.seed(0)
x = np.random.randn(100)

# Set the Seaborn style
sns.set_style('white')

# Specify a color for plotting
current_palette = matplotlib.colors.hex2color('#86b92e')

# Make a plot
g = sns.distplot(x, color=current_palette)
Run Code Online (Sandbox Code Playgroud)

具有柔和色彩的直方图

# Show what the color should look like
sns.palplot(current_palette)
Run Code Online (Sandbox Code Playgroud)

颜色应该是什么样子

我已经尝试了几种方法来指定Seaborn中的颜色和所有可用的样式,但没有任何效果.我正在使用iPython笔记本和Python 2.7.

Eli*_*hAB 4

它不使用柔和的颜色,而是使用 alpha/透明度值作为默认值的一部分。

两个答案引用了修改 matplotlib 对象透明度的方法: