Is there anyway to expose alpha
parameter in seaborn
displot
function?
Here is some sample code:
import pandas as pd
import numpy as np
import seaborn as sns
A = np.random.standard_normal(20)
B = np.random.standard_normal(20)
C = ['cat1','cat2',]*10
z = pd.DataFrame({'col1':A,'col2':B,'col3':C})
sns.displot(data = z, x = 'col1',hue = 'col3')
I tried using hist_kws
but it doesn't seem to have it.
I want the histograms to overlap but I want them to be transparent.
sns.displot(data = z, x = 'col1',hue = 'col3',hist_kws= {'alpha': 0.1})
'Rectangle' object has no property 'hist_kws'
To keep the histograms overlapping, but transparent, you should use alpha = 0
. I think the hist_kws
is valid for the older distplot. Is this what you are looking for? Just be aware that alpha=0, will not allow you to differentiate between the two plots. Maybe alpha=0.1 would help....
A = np.random.standard_normal(20)
B = np.random.standard_normal(20)
C = ['cat1','cat2',]*10
z = pd.DataFrame({'col1':A,'col2':B,'col3':C})
sns.displot(data = z, x = 'col1',hue = 'col3', alpha=0)