小编Tur*_*rke的帖子

如何从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')
Run Code Online (Sandbox Code Playgroud)

花瓣长度分布

python colors histogram seaborn

3
推荐指数
1
解决办法
3597
查看次数

标签 统计

colors ×1

histogram ×1

python ×1

seaborn ×1