x = numpy.arange(0.0, 5, 1)
y = numpy.array([np.nan,2,3,4,5])
plt.plot(x,y)
I am trying to plot, but the graph always starts with 1 instead of 0. Can I force it to start with 0 ?
x = numpy.arange(0.0, 5, 1)
y = numpy.array([np.nan,2,3,4,5])
plt.plot(x,y)
I am trying to plot, but the graph always starts with 1 instead of 0. Can I force it to start with 0 ?
Use the following to set the minimum x value to 0:
import numpy
import matplotlib.pyplot as plt
x = numpy.arange(0.0, 5, 1)
y = numpy.array([numpy.nan, 2, 3, 4, 5])
plt.plot(x, y)
plt.xlim(xmin=0)
plt.show()
You can do the same for the y-axis by using ylim
:
plt.ylim(ymin=0)