How do I remove transparency from a histogram created using Seaborn in python?
10,364
sns.distplot(iris.petal_length, axlabel = 'Petal Length', hist_kws=dict(alpha=1))
Author by
Turke
Updated on June 13, 2022Comments
-
Turke about 2 years
I'm creating histograms using seaborn in python and want to customize the colors. The default settings create transparent histograms, and I would like mine to be solid. How do I remove the transparency?
I've tried creating a color palette and setting desaturation to 0, but this hasn't changed the saturation of the resulting histogram.
Example:
# 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')