Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Center labels matplotlib histogram

n, bins, patches = plt.hist(x, bins=n_bins, edgecolor='black')
ticks = [(patch._x0 + patch._x1)/2 for patch in patches]
ticklabels = [i for i in range(n_bins)]
plt.xticks(ticks, ticklabels)
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #Center #labels #matplotlib #histogram
ADD COMMENT
Topic
Name
7+6 =