2016-05-06 102 views
0

我使用python中的seaborn创建直方图,并且想要自定义颜色。默认设置创建透明直方图,我希望我的实体。我如何删除透明度?如何从使用Python中的Seaborn创建的直方图中删除透明度?

我已经尝试创建一个调色板并将饱和度设置为0,但是这并没有改变生成的直方图的饱和度。

实施例:

# In[1]: 

import seaborn as sns 
import matplotlib.pyplot as plt 
get_ipython().magic('matplotlib inline') 


# In[2]: 

iris = sns.load_dataset("iris") 


# In[3]: 

myColors = ['#115e67','#f4633a','#ffd757','#4da2e8','#cfe5e5'] 
sns.palplot(sns.color_palette(myColors)) 


# In[4]: 

sns.set_palette(palette=myColors,desat=0) 


# In[5]: 

sns.set(style="white") 


# In[6]: 

sns.despine() 


# In[7]: 

plt.title('Distribution of Petal Length') 
sns.distplot(iris.petal_length, axlabel = 'Petal Length') 

Distribution of petal length

回答

1
sns.distplot(iris.petal_length, axlabel = 'Petal Length', hist_kws=dict(alpha=1)) 
相关问题