Last active
February 16, 2021 12:45
-
-
Save ksv-muralidhar/da21d460e190ea288430290380817885 to your computer and use it in GitHub Desktop.
histogram bins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig,ax = plt.subplots(2,3,figsize=(15,10)) | |
row = col = 0 | |
np.random.seed(11) | |
norm_dist = np.random.randn(1000) | |
for n,i in enumerate(np.linspace(5,100,6)): | |
if (n>0) & (n%3==0): | |
row += 1 | |
col = 0 | |
sns.histplot(x=norm_dist,bins=int(i),ax=ax[row,col]) | |
ax[row,col].set_title(f'bins = {int(i)}') | |
col += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
np.random.seed(11) | |
norm_dist = np.random.randn(1000) | |
bin_count = int(np.ceil(np.log2(len(norm_dist))) + 1) | |
fig = plt.figure(figsize=(7,7)) | |
sns.histplot(x=norm_dist,bins=bin_count) | |
plt.title(f'bins = {bin_count}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment