I want to plot a histogram of electrical resistivity values ranging from 0 to 1200, spaced out around 200 units between. I have my values saved in a file on my laptop; there are 1600 measurements each of which can be any number in that range. However, when I try to create a histogram from that list of values, the x-axis labels takes on every value in that list How it looks, rather than 0 - 200 - 400 - 600 - 800 - 1000 - 1200, as I want. How I would like it to look . In short, how do I change the xlabel to go from 1600 individual values to 0 - 200 - 400 - 600 - 800 - 1000 - 1200?
I hope you can see the images - I'm not allowed to post them directly. If not, I hope that my explanation was relatively clear. Thanks!
Thanks so far but plt.xticks(ticks=[0, 200, 400, 600, 800, 1000, 1200]) doesn't quite work: enter image description here
CodePudding user response:
you should set xticks
as:
import matplotlib.pyplot as plt
plt.plot(x, y)
plt.xticks(ticks=[0, 200, 400, 600, 800, 1000])