0

As you know in matplotlib plot, it shows a value for x and a value for y while hovering the mouse on plots (the red border in the picture below).

Is there any way to hide them and make plt not to show them at all? So the figure does not show the values after mouse hovers on plot.

# just a simple code
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [1, 2, 3, 4]
plt.plot(x, y)
plt.show()

enter image description here

1 Answer 1

2

You can reassign the callback function that displays the coordinates (ax.format_coord) to a function that outputs an empty string:

from matplotlib import pyplot as plt
import numpy as np

plt.scatter(np.random.rand(20), np.random.rand(20))
plt.gca().format_coord = lambda x,y: ""
plt.show()

This example uses the function to show pixel values.

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

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.