📅 2015-Jun-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ axis, matplotlib ⬩ 📚 Archive
For most types of plots drawn by Matplotlib, the ticks and labels along both X and Y axis is drawn too. To hide the ticks, labels or axis, we need to get the axes of the currently generated plot and change its properties.
import matplotlib.pyplot as mplot
# After creating plot ...
= mplot.gca()
cur_axes False)
cur_axes.axes.get_xaxis().set_visible(False) cur_axes.axes.get_yaxis().set_visible(
import matplotlib.pyplot as mplot
# After creating plot ...
= mplot.gca()
cur_axes
cur_axes.axes.get_xaxis().set_ticks([]) cur_axes.axes.get_yaxis().set_ticks([])
import matplotlib.pyplot as mplot
# After creating plot ...
= mplot.gca()
cur_axes
cur_axes.axes.get_xaxis().set_ticklabels([]) cur_axes.axes.get_yaxis().set_ticklabels([])
Tried with: Matplotlib 1.3.1 and Ubuntu 14.04