Hello John and NG,
>> I answered this question before at
> Probably I did not make myself clear.
>> In a nutshell, do not manually bind 'g' to toggle the grid.
>> This already happens by default in matplotlib 0.72.
> I am NOT manually binding the "g" key! I have NO
> key_press_event on my routines. Similarly, the examples:
> - embedding_in_wx.py - embedding_in_wx2.py -
OK, I see. Sorry for the confusion. The default keybindings are made
in the backend FigureManager classes. All of the examples you
referenced embed matplotlib in a wx app. The ones that use the
FigureManagerWX (eg embedding_in_wx.py) have the default key bindings;
the ones that don't use FigureManagerWX (eg embedding_in_wx2.py), do
not. If you don't use the manager, you have to do the bindings you
want yourself. Eg, in embedding_in_wx2.py
self.canvas = FigureCanvas(self, -1, self.figure)
Hope this helps,