MATLAB: How to set disableDef​aultIntera​ctivity for all axes

disabledefaultinteractivity

In Matlab 2018b and later, the cursor is set to automatically interact with the plot. This messes up my plots (accidentally moving axes or adding unwanted data tips), so I would like to turn it off. You can do this for a specific axis ax with disableDefaultInteractivity(ax). However I would like to apply this to all axes I ever make. I know you can set preferences for some axis properties as follows,
set(0,'DefaultAxesColor', 'none');
But the following attemps did not work,
disableDefaultInteractivity(0) % Error: Input must be an axes handle
set(0, 'DefaultInteractivity', 'off') % Error: Too many output arguments
Is there another way to disable the axis interactivity for all axes?

Best Answer

In order to disable default interactivity for all created axes, you can use the following command:
>> set(groot,'defaultAxesCreateFcn','disableDefaultInteractivity(gca)')
But this setting will be reset when MATLAB is restarted.