I have a figure with different plots on several axes. Some of those axes do not play well with some of the navigation toolbar actions. In particular, the shortcuts to go back to the home view and the ones to go to the previous and next views.
Is there a way to disable those shortcuts only for those axes? For example, in one of the two in the figure from the example below.
import matplotlib.pyplot as plt
# Example data for two plots
x1 = [1, 2, 3, 4]
y1 = [10, 20, 25, 30]
x2 = [2, 3, 4, 5]
y2 = [5, 15, 20, 25]
# Create figure and axes objects
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
# Plot data on the first axis
ax1.plot(x1, y1)
ax1.set_title("First Plot")
# Plot data on the second axis
ax2.plot(x2, y2)
ax2.set_title("Second Plot")
# Show plot
plt.show()
Edit 1:
The following method will successfully disable the pan and zoom tools from the GUI toolbox in the target axis.
ax2.set_navigate(False)
However, the home, forward, and back buttons remain active. Is there a trick to disable also those buttons in the target axis?
from How to disable the Matplotlib navigation toolbar in a particular axis?
No comments:
Post a Comment