Disable display of coordinates in matplotlib plot

Now I am embedding a matplotlib plot in a simple GUI. While setting up the plot, I found that some display issues came up when I added the toolbar to the plot using NavigationToolbar2TkAgg

. Now I want to turn off the display of coordinates on the right side of the bottom of the graph when the mouse moves over the plot if we add toolbars on the left side of the bottom. Any ideas about this?

Thanks in advance.

Update:

For a figure just drawn plt.plot(x,y)

, the coordinates are displayed on the bottom left as you move the mouse, since toolbars (eg, home, zoom, etc.) are listed at the top by default. It will be much clearer to look at the Google Drive screenshot here and I have highlighted the coordinates in yellow, which can be found in the lower left corner of the image. Thanks to GWW and jgysland for reminding me.

+3


source to share


1 answer


You want the opposite of the matplotlib values ​​under the cursor , but the solution is the same, you need to rewrite the attribute format_coord

to Axes

an object.

ax.format_coord = lambda x, y: ''

      

should do the trick where ax

is the reference to the axes object you care about.



Another option is to subclass NavigationToolbar2TkAgg

and make the function set_message

no-op

class my_toolbar(NavigationToolbar2TkAgg):
    def set_message(self, msg):
        pass

      

+4


source







All Articles