matplotlib get data from plt.hist code example
Example 1: plt.hist using bins
counts, bins = np.histogram(data)
plt.hist(bins[:-1], bins, weights=counts)
Example 2: python matpotlib histplot
import matplotlib.pyplot as plt
plt.hist(x) #x is a array of numbers
plt.show()