hist python code example

Example 1: mido python

>>> import mido
>>> msg = mido.Message('note_on', note=60)
>>> msg.type
'note_on'
>>> msg.note
60
>>> msg.bytes()
[144, 60, 64]
>>> msg.copy(channel=2)
<message note_on channel=2 note=60 velocity=64 time=0>

Example 2: plt normalized histogram

plt.hist(data, density=True)

Example 3: std python

import numpy as np
values=[1,10,100]
print(np.std(values))
values=[1,10,100,np.nan]
print(np.nanstd(values))

Example 4: matplotlib hist

# Import packages
import matplotlib.pyplot as plt
%matplotlib inline

# Create the plot
fig, ax = plt.subplots()

# Plot the histogram with hist() function
ax.hist(x, edgecolor = "black", bins = 5)

# Label axes and set title
ax.set_title("Title")
ax.set_xlabel("X_Label")
ax.set_ylabel("Y_Label")

Example 5: python matpotlib histplot

import matplotlib.pyplot as plt
plt.hist(x) #x is a array of numbers
plt.show()

Example 6: 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)