[Matplotlib-users] trouble removing tick labels
Eric Firing
efiring at hawaii.edu
Thu Mar 19 18:42:31 EDT 2020
Jon,
If you are removing the tick labels it suggests that the y-axes are all
matched, in which case using
fig, axs = plt.subplots(2, 2, sharey=True)
should do what you want.
If not, please supply a minimal but complete example illustrating the
problem.
Eric
On 2020/03/19 11:36 AM, Slavin, Jonathan wrote:
> 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
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
More information about the Matplotlib-users
mailing list