Note that there are some explanatory texts on larger screens.

plurals
  1. POHiding axis text in matplotlib plots
    primarykey
    data
    text
    <p>I'm trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where matplotlib adjusts the x(y)ticklabels by subtracting a value N, then adds N at the end of the axis.</p> <p>This may be vague, but the following simplified example highlights the issue, with '6.18' being the offending value of N:</p> <pre><code>import matplotlib.pyplot as plt import random prefix = 6.18 rx = [prefix+(0.001*random.random()) for i in arange(100)] ry = [prefix+(0.001*random.random()) for i in arange(100)] plt.plot(rx,ry,'ko') frame1 = plt.gca() for xlabel_i in frame1.axes.get_xticklabels(): xlabel_i.set_visible(False) xlabel_i.set_fontsize(0.0) for xlabel_i in frame1.axes.get_yticklabels(): xlabel_i.set_fontsize(0.0) xlabel_i.set_visible(False) for tick in frame1.axes.get_xticklines(): tick.set_visible(False) for tick in frame1.axes.get_yticklines(): tick.set_visible(False) plt.show() </code></pre> <p>The three things I would like to know are:</p> <ol> <li><p>How to turn off this behaviour in the first place (although in most cases it is useful, it is not always!) I have looked through <code>matplotlib.axis.XAxis</code> and cannot find anything appropriate</p></li> <li><p>How can I make N disappear (i.e. <code>X.set_visible(False)</code>)</p></li> <li><p>Is there a better way to do the above anyway? My final plot would be 4x4 subplots in a figure, if that is relevant.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload