1

I don't want any subplot's label. Right now, I have to set every subplot axes one by one. Any way to set them all together.

f, ((ax1, ax2),(ax3, ax4)) = plt.subplots(2,2)
ax1.set_ylabel('')
ax1.set_ylabel('')
ax2.set_ylabel('')
ax2.set_ylabel('')
....

1 Answer 1

3

You could use a loop over all axes:

f, axarr = plt.subplots(2,2)
for ax in axarr.flat:
    ax.set_xlabel('')
    ax.set_ylabel('')

or even shorter:

f, axarr = plt.subplots(2,2)
for ax in axarr.flat:
    ax.set(xlabel='', ylabel='')
Sign up to request clarification or add additional context in comments.

2 Comments

thanks! any different between using axarr or more complicated ((ax1, ax2),(ax3, ax4))?
((ax1, ax2),(ax3, ax4)) is just the unpacked version of axarr. ax1=ax[0, 0] and so on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.