Elkan
Elkan

Reputation: 616

Disable displaying coordinate in matplotlib plot

I'm now embedding matplotlib plot in a simple GUI. During the customization of the plot, I found some displaying issues occurred when I added tool bar under the plot using NavigationToolbar2TkAgg. Now I want to disable displaying coordinate at right side of the bottom of plot when mouse moves around the plot, if we add tool bars at the left side of the bottom. Any idea about this?

Thanks in advance.

Update:

For a figure simply drawn by plt.plot(x,y), the coordinates are displayed at left side of the bottom along with mouse moving as tool bars (like "home", "zoom" etc.) are listed at the top by default. It will be much clearer to view the screen shot at google drive here and I highlighted the coordinates in yellow, which one can find at the bottom left of the image. Thanks GWW and jgysland for reminding me.

Upvotes: 3

Views: 4314

Answers (1)

tacaswell
tacaswell

Reputation: 87556

You want the opposite of matplotlib values under cursor, but the solution is the same, you need to over-write the format_coord attribute on the Axes object.

ax.format_coord = lambda x, y: ''

should do the trick where ax is a reference to the axes object you care about.

Another option is to sub-class NavigationToolbar2TkAgg and make the set_message function a no-op

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

Upvotes: 8

Related Questions