1

I have recently used a solution found in StackOverflow to remove icons on the Toolbar, however, I cannot remove one and I do not know why. I was wondering if anyone has seen and removed this extra icon successfully. The answer I used was: https://stackoverflow.com/a/15549675

This is how I used it:

from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar

class NavigationToolbar(NavigationToolbar):
    # only display the buttons we need
    toolitems = [t for t in NavigationToolbar.toolitems if
                 t[0] in ('Pan', 'Zoom', 'Save')]

And the extra icon looks like: https://i.stack.imgur.com/rG0Ll.png

enter image description here

Thanks!

Community
  • 1
  • 1
user2570374
  • 27
  • 1
  • 4

1 Answers1

2

See https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_qt4.py#L586 for where that icon is added. It is done outside of the toolitem list, hence why this method didn't work.

Adding

matplotlib.backends.backend_qt.figureoptions = None

will do what you want.

tacaswell
  • 84,579
  • 22
  • 210
  • 199