Reputation: 13015
I use the following code to plot the histogram. If I want to make the label along the x-axis more fine grained, how to change the code. For instance, the current plot segment the x-axis with 0.2 as interval, can I have 0.05 as interval?
import matplotlib.pyplot as plt
plt.hist(image_pixel_array,bins=25,color='g')
plt.grid(True)
plt.show()
Upvotes: 1
Views: 10478
Reputation: 2918
Here,
plt.xlim([-3, 3])
plt.ylim([-3, 3])
plt.yticks(np.arange(-3, 3, 0.5))
plt.xticks(np.arange(-3, 3, 0.5))
plt.show()
you'll get the ticks 0.5 distance apart in the range of -3 to 3. Hope this helps.
Upvotes: 6