How to use 'seaborn histplot' in Python

Every line of 'seaborn histplot' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
88def plot_hist(axes, data, xlabel=None, log=False, avg=True, median=True, bins=None, **kwargs):
89 time_max = max(data)
90 time_min = min(data)
91 time_avg = np.average(data)
92 time_median = np.median(data)
93 if bins is None:
94 bins = time_max - time_min + 1
95 hist = axes.hist(data, bins=bins, log=log, **kwargs)
96 if avg:
97 axes.axvline(x=time_avg, alpha=0.7, linestyle="dotted", color="blue", label="avg = {}".format(time_avg))
98 if median:
99 axes.axvline(x=time_median, alpha=0.7, linestyle="dotted", color="green", label="median = {}".format(time_median))
100 axes.set_ylabel("count" + ("\n(log)" if log else ""))
101 axes.set_xlabel("time" if xlabel is None else xlabel)
102 axes.xaxis.set_major_locator(ticker.MaxNLocator())
103 if avg or median:
104 axes.legend(loc="best")
105 return hist

Related snippets