How to remove toolbar buttons from matplotlib

后端 未结 2 1749
长情又很酷
长情又很酷 2021-01-01 07:25

I want to remove some of the buttons from plot toolbar (matplotlib).

I saw that there are some old solutions:

How to modify the navigation too

2条回答
  •  再見小時候
    2021-01-01 08:23

    After trying many solutions, I have found that this works very well.

    toolbar = plt.get_current_fig_manager().toolbar
    unwanted_buttons = ['Subplots','Save']
    for x in toolbar.actions():
        if x.text() in unwanted_buttons:
            toolbar.removeAction(x)
    

提交回复
热议问题