Remove the ticks and labels in Matplotlib
The plot()
in matplotlib.pyplot draws x and y ticks and number labels in default.
import numpy
from matplotlib import pyplot
x = numpy.arange(-2, 5, 0.1)
y = x * x - 1
pyplot.plot(x, y)
pyplot.savefig('plot.jpg')
Remove ticks
If you want to remove those ticks, set the top, bottom, left, right options in tick_params()
to False.
import numpy
from matplotlib import pyplot
x = numpy.arange(-2, 5, 0.1)
y = x * x - 1
pyplot.plot(x, y)
pyplot.tick_params(top=False, bottom=False, left=False, right=False)
pyplot.savefig('tick.jpg')
Remove labels
And if labelleft and labelbottom are False, the number labels on axes are removed.
import numpy
from matplotlib import pyplot
x = numpy.arange(-2, 5, 0.1)
y = x * x - 1
pyplot.plot(x, y)
pyplot.tick_params(top=False, bottom=False, left=False, right=False, labelleft=False, labelbottom=False)
pyplot.savefig('label.jpg')