0

I have multiple subplots but I cant seem to remove the axis from all of the plots, only one of them. What is the best way to do this?

import numpy as np
import matplotlib.pyplot as plt

array_list = [np.random.random_integers(0, i, (5,5)).astype(bool) for i in range(10)]

count = 0    
fig, axes = plt.subplots(nrows=2, ncols=5)
for i in range(2):
    for j in range(5):
        axes[i, j].imshow(array_list[count], interpolation='nearest')
        count += 1
plt.axis('off')
plt.show()

1 Answer 1

2

You need to turn off the axis for each subplot. Try the following code and see if it is what you want.

import numpy as np
import matplotlib.pyplot as plt

array_list = [np.random.random_integers(0, i, (5,5)).astype(bool) for i in range(10)]

count = 0    
fig, axes = plt.subplots(nrows=2, ncols=5)
for i in range(2):
    for j in range(5):
        axes[i, j].imshow(array_list[count], interpolation='nearest')
        count += 1
        axes[i, j].axis('off')
plt.show()
Sign up to request clarification or add additional context in comments.

1 Comment

ah brilliant, something simple!

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.