11

I put the image in a NumPy array, and draw it with the following code. How can I tell the program not to draw the axes, like (0, 100, 200...)

import matplotlib.pyplot as plt

plt.figure()
plt.imshow(output_ndarray)
plt.savefig(output_png)

aflw picture

3
  • 2
    Blatant plug: If you want to write a numpy array directly to a PNG file, you can use the package numpngw that I wrote. Commented Oct 19, 2016 at 3:05
  • This is not hiding axes, but ticks and their labels.The Axes object also contains the image and other "artists". For those searching for actually hiding the axes: ax.set_visible(False) Commented Apr 13, 2021 at 22:32
  • What is "aflw" (in the pictire embedded description)? AFLW, AFL Women's, Australia's national semi-professional Australian rules football league for female players? Commented Dec 14, 2022 at 22:12

2 Answers 2

15

enter image description hereYou can also use...

plt.axis('off')

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

This is the easiest way to to it. Note for object-oriented api, it is the same ax.axis('off') which is nice.
12
plt.xticks([])
plt.yticks([])

http://matplotlib.org/api/pyplot_api.html

Comments

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.