Reputation: 25560
I made a histogram plot with matplotlib
, but the histogram occupies all space on the plot, I would like to add more space around. How can I scale down the histogram, but keep number on the axis the same size?
Upvotes: 1
Views: 87
Reputation: 1644
Could you change the xlimits? try:
fig, ax = plt.subplots(1)
ax.hist(data)
vmin = data.min().min()
vmax = data.max().max()
data_range = vmax - vmin
scale_factor = 0.1
xmin = vmin - scale_factor*vmax
xmax = vmax + scale_factor*vmax
ax.set_xlim(xmin, xmax)
Upvotes: 1