How to modify the navigation toolbar easily in a matplotlib figure window?

前端 未结 6 1305
暖寄归人
暖寄归人 2020-11-30 04:05

Is it possible to do something like the following to modify the navigation toolbar in matplotlib?

  1. Generate a figure window, with: fig = figure()
6条回答
  •  旧巷少年郎
    2020-11-30 05:02

    I found that just that

    fig = plt.figure()
    toolbar = fig.canvas.manager.toolbar
    tb=toolbar.toolitems
    while len(tb)>0:
        tb.pop(0)
    

    worked to remove all tools, and popping individual tools worked too. That said,

    toolbar.toolitems=[]
    

    didnt work, so the code must have another reference to this array somewhere.

提交回复
热议问题