I read this in the matplotlib tutorial:
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)
I am wondering what are n, bins, and patches
I was going to suggest reading the docs but this provides no extra explanation although I still advise you have a look.
n
: is the number of counts in each bin of the histogrambins
: is the left hand edge of each binpatches
is the individual patches used to create the histogram, e.g a collection of rectanglesThe patches can be used to change the properties of individual bars as in these examples. Here is a simple example of its use
import numpy as np
import matplotlib.pyplot as plt
x = np.random.normal(size=100)
n, bins, patches = plt.hist(x)
plt.setp(patches[0], 'facecolor', 'g')
plt.show()
In general the n
and bins
are used for subsequent data analysis as in this demo