I have a plot using matplotlib and I want to remove some of the buttons from the toolbar.
I have achieved removing the forward, back, home, zoom and help buttons, but when I try to remove the "Configure subplots" button I get an error.
Why can't I remove this one but I can remove the others?
My code is something like this:
import matplotlib.pyplot as plt
plt.rcParams['toolbar'] = 'toolmanager'
fig = plt.figure()
fig.canvas.manager.toolmanager.remove_tool('forward')
fig.canvas.manager.toolmanager.remove_tool('back')
fig.canvas.manager.toolmanager.remove_tool('home')
fig.canvas.manager.toolmanager.remove_tool('zoom')
fig.canvas.manager.toolmanager.remove_tool('help')
fig.canvas.manager.toolmanager.remove_tool('subplots')
If I comment the last line, the code runs without problem and I get the toolbar without the specified buttons, but if I add the last line I get the following error:
AttributeError: 'NoneType' object has no attribute 'destroy'
I have tried all type of combinations from 'subplots', in case the name is not correct like
- '
Subplot', - '
Subplots', - '
subplot', - '
configure', - '
configure_subplots', - '
Configure subplots'