[Matplotlib-users] trouble removing tick labels

Slavin, Jonathan jslavin at cfa.harvard.edu
Thu Mar 19 17:36:18 EDT 2020


Hi,

I'm making a plot that's a grid of 4 x 4 axes. I'd like to remove the tick
labels for the y axes that are not in the first column. I tried using what
I saw in an example:
for ax in axs.flat:
    ax.label_outer()
but that seems to have no effect. I found where the code that defines that
function is and tried to use that code directly:
for ax in axs.flat:
    if ax.colNum != 0:
        for label in ax.get_yticklabels(which='both'):
            label.set_visible(False)
        ax.get_yaxis().get_offset_text().set_visible(False)
        ax.set_ylabel("")
but again no effect. Does anyone have any ideas why these are not working?
Any help would be appreciated.

Regards,
Jon


-- 
Jonathan D. Slavin
Astrophysicist - High Energy Astrophysics Division
Center for Astrophysics | Harvard & Smithsonian
Office: (617) 496-7981 | Cell: (781) 363-0035
60 Garden Street | MS 83 | Cambridge, MA 02138
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200319/f80bde06/attachment-0001.html>


More information about the Matplotlib-users mailing list