Python matplotlib - setting x-axis scale

Hey it looks like you need to set the x axis scale.

Try

matplotlib.axes.Axes.set_xscale(1, 'linear')

Here's the documentation for that function


Just set the xticks yourself.

plt.xticks([1,2,3,4])

or

plt.xticks(valueX)

Since the range functions happens to work with integers you could use that instead:

plt.xticks(range(1, 5))

Or be even more dynamic and calculate it from the data:

plt.xticks(range(min(valueX), max(valueX)+1))

Below is my favorite way to set the scale of axes:

plt.xlim(-0.02, 0.05)
plt.ylim(-0.04, 0.04)