Skip to content

Using the "new" toolbar manager still triggers warnings referring to V. 1.5 / 2.1 #15284

Closed
@EBenkler

Description

@EBenkler

Bug report

Bug summary

Using the "new" toolbar manager still triggers warnings referring to V. 1.5 / 2.1, although we are now at V.3.1.1. I wonder if the warning still applies, or if it could be removed, since it is rather annoying and is triggered e.g. in plt.figure()? Are there any workarounds? As far as I understand, there is an old and a new toolbar manager, but I don't know how I could implement a toggle button using the old one.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['toolbar'] = 'toolmanager'
from matplotlib.backend_tools import ToolToggleBase

class toggle_example(ToolToggleBase):
    default_keymap = 't'
    description = 'Toggle Button'

t= np.arange(1e5)/1e5
y= np.random.randn(int(1e5))
    
plt.close(fig=1)
plt.figure(1)
plt.plot(t,y)

plt.gcf().canvas.manager.toolmanager.add_tool('Toggle example', toggle_example)
plt.gcf().canvas.manager.toolbar.add_tool('Toggle example', 'zoompan', 2)

Actual outcome

Treat the new Tool classes introduced in v1.5 as experimental for now, the API will likely change in version 2.1 and perhaps the rcParam as well
__main__:15: UserWarning: The new Tool classes introduced in v1.5 are experimental; their API (including names) will likely change in future versions.
__main__:18: UserWarning: The new Tool classes introduced in v1.5 are experimental; their API (including names) will likely change in future versions.

Expected outcome

I would expect not to see these warnings each time a new figure is opened.

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.7
  • Jupyter version (if applicable):
  • Other libraries:
    conda default channel installed on Miniconda

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions