How to disable keyboard shortcuts in Matplotlib?

I work with handling some events in matplotlib. In particular, "key_press_event". But predefined keyboard shortcuts bother me. Is there any way to disable them?

They say that I can override keys using: "matplotlibrc (# keymap. *)". But I do not understand what they are talking about, and I did not find any further explanations.

+7
source share
1 answer

You can change the dictionary plt.rcParams . For example, to disable the "s" key combination for the "Save Picture" button:

 >>> import matplotlib.pyplot as plt >>> plt.rcParams['keymap.save'] 's' >>> plt.rcParams['keymap.save'] = '' 

If you want the changes to be applied globally / permanently, then edit the matplotlibrc file and restart the Python interpreter. You can find the location of the configuration file on your system by calling a helper function:

 >>> matplotlib.matplotlib_fname() '/Users/wim/.matplotlib/matplotlibrc' 
+9
source

All Articles