remove labels in bar plot python code example
Example 1: python remove x and y values on plots
ax.set_yticklabels([])
ax.set_xticklabels([])
import matplotlib.pyplot as plt
fig,ax = plt.subplots(1)
ax.plot(range(1, 10),range(10, 1, -1))
ax.set_ylabel('Y Label')
ax.set_xlabel('X Label')
ax.set_yticklabels([])
ax.set_xticklabels([])
plt.show()
Example 2: plt hide axis ticks
pythonCopyimport matplotlib.pyplot as plt
plt.plot([0, 10], [0, 10])
plt.xlabel("X Label")
plt.ylabel("Y Label")
ax = plt.gca()
ax.axes.xaxis.set_visible(False)
ax.axes.yaxis.set_visible(False)
plt.grid(True)
plt.show()