1import matplotlib.pyplot as plt
2data = [1.7,1.8,2.0,2.2,2.2,2.3,2.4,2.5,2.5,2.5,2.6,2.6,2.8,
3 2.9,3.0,3.1,3.1,3.2,3.3,3.5,3.6,3.7,4.1,4.1,4.2,4.3]
4#this histogram has a range from 1 to 4
5#and 8 different bins
6plt.hist(data, range=(1,4), bins=8)
7plt.show()
1# Import packages
2import matplotlib.pyplot as plt
3%matplotlib inline
4
5# Create the plot
6fig, ax = plt.subplots()
7
8# Plot the histogram with hist() function
9ax.hist(x, edgecolor = "black", bins = 5)
10
11# Label axes and set title
12ax.set_title("Title")
13ax.set_xlabel("X_Label")
14ax.set_ylabel("Y_Label")
1import pyplot from matplotlib as plt
2plt.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)