Skip to content

Instantly share code, notes, and snippets.

@kshirsagarsiddharth
Created January 3, 2022 07:12
Show Gist options
  • Select an option

  • Save kshirsagarsiddharth/cfeb4cf12156ab7bb7371d4fbf97ff31 to your computer and use it in GitHub Desktop.

Select an option

Save kshirsagarsiddharth/cfeb4cf12156ab7bb7371d4fbf97ff31 to your computer and use it in GitHub Desktop.
def plot_histogram(bins = 10, hue = 'categories', kde = False, palette = 'Blues', x_range_1 = (-3,3)):
"""plots histogram
params:
=======
bins: int
histogram bins
hue: str
categorical columns to color
kde: bool
wether to show kde plot
palette: str
palette of histogram
x_range_1: tuple(int,int)
x range of the plot
returns:
histogram
"""
plt.figure(dpi = 120)
sns.histplot(data = sample_df,
x = 'values',
palette=palette,
bins = bins,
hue = hue,
kde = kde,
)
plt.xlim(x_range_1)
plot_histogram()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment