python hist code example
Example 1: plt normalized histogram
plt.hist(data, density=True)
Example 2: matplotlib hist
import matplotlib.pyplot as plt
%matplotlib inline
fig, ax = plt.subplots()
ax.hist(x, edgecolor = "black", bins = 5)
ax.set_title("Title")
ax.set_xlabel("X_Label")
ax.set_ylabel("Y_Label")
Example 3: plt.hist using bins
counts, bins = np.histogram(data)
plt.hist(bins[:-1], bins, weights=counts)
Example 4: python matpotlib histplot
import matplotlib.pyplot as plt
plt.hist(x)
plt.show()
Example 5: plt.hist bins
matplotlib.pyplot.hist(x, bins=None, range=None, density=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, *, data=None, **kwargs)