{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/10855","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/10855/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/10855/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/10855/events","html_url":"https://github.com/matplotlib/matplotlib/issues/10855","id":307245928,"number":10855,"title":"Embedding in Qt example gives AttributeError: 'Figure' object has no attribute 'subplots'","user":{"login":"titusjan","id":3320415,"avatar_url":"https://avatars1.githubusercontent.com/u/3320415?v=4","gravatar_id":"","url":"https://api.github.com/users/titusjan","html_url":"https://github.com/titusjan","followers_url":"https://api.github.com/users/titusjan/followers","following_url":"https://api.github.com/users/titusjan/following{/other_user}","gists_url":"https://api.github.com/users/titusjan/gists{/gist_id}","starred_url":"https://api.github.com/users/titusjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titusjan/subscriptions","organizations_url":"https://api.github.com/users/titusjan/orgs","repos_url":"https://api.github.com/users/titusjan/repos","events_url":"https://api.github.com/users/titusjan/events{/privacy}","received_events_url":"https://api.github.com/users/titusjan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-21T13:33:07Z","updated_at":"2018-03-21T18:01:27Z","closed_at":null,"author_association":"NONE","body":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nWhen I run the example from [Embedding in Qt](https://matplotlib.org/gallery/user_interfaces/embedding_in_qt_sgskip.html) I get an `AttributeError: 'Figure' object has no attribute 'subplots'`, which is strange because according to [the documentation](https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.subplots) it does.\r\n\r\n\r\n\r\n**Code for reproduction**\r\n\r\nThe example code is copied below.\r\n```\r\n\r\nimport sys\r\nimport time\r\n\r\nimport numpy as np\r\n\r\nfrom matplotlib.backends.qt_compat import QtCore, QtWidgets, is_pyqt5\r\nif is_pyqt5():\r\n    from matplotlib.backends.backend_qt5agg import (\r\n        FigureCanvas, NavigationToolbar2QT as NavigationToolbar)\r\nelse:\r\n    from matplotlib.backends.backend_qt4agg import (\r\n        FigureCanvas, NavigationToolbar2QT as NavigationToolbar)\r\nfrom matplotlib.figure import Figure\r\n\r\n\r\nclass ApplicationWindow(QtWidgets.QMainWindow):\r\n    def __init__(self):\r\n        super(ApplicationWindow, self).__init__()\r\n        self._main = QtWidgets.QWidget()\r\n        self.setCentralWidget(self._main)\r\n        layout = QtWidgets.QVBoxLayout(self._main)\r\n\r\n        static_canvas = FigureCanvas(Figure(figsize=(5, 3)))\r\n        layout.addWidget(static_canvas)\r\n        self.addToolBar(NavigationToolbar(static_canvas, self))\r\n\r\n        dynamic_canvas = FigureCanvas(Figure(figsize=(5, 3)))\r\n        layout.addWidget(dynamic_canvas)\r\n        self.addToolBar(QtCore.Qt.BottomToolBarArea,\r\n                        NavigationToolbar(dynamic_canvas, self))\r\n\r\n        self._static_ax = static_canvas.figure.subplots()\r\n        t = np.linspace(0, 10, 501)\r\n        self._static_ax.plot(t, np.tan(t), \".\")\r\n\r\n        self._dynamic_ax = dynamic_canvas.figure.subplots()\r\n        self._timer = dynamic_canvas.new_timer(\r\n            100, [(self._update_canvas, (), {})])\r\n        self._timer.start()\r\n\r\n    def _update_canvas(self):\r\n        self._dynamic_ax.clear()\r\n        t = np.linspace(0, 10, 101)\r\n        # Shift the sinusoid as a function of time.\r\n        self._dynamic_ax.plot(t, np.sin(t + time.time()))\r\n        self._dynamic_ax.figure.canvas.draw()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    qapp = QtWidgets.QApplication(sys.argv)\r\n    app = ApplicationWindow()\r\n    app.show()\r\n    qapp.exec_()\r\n\r\n```\r\n\r\n**Actual outcome**\r\n\r\nMy stack strace is:\r\n```\r\n/usr/bin/python3.5 /home/pepijnk/src/egse/python/gssw/quicklook/trials/mpl_test.py\r\nTraceback (most recent call last):\r\n  File \"/home/pepijnk/src/egse/python/gssw/quicklook/trials/mpl_test.py\", line 52, in <module>\r\n    app = ApplicationWindow()\r\n  File \"/home/pepijnk/src/egse/python/gssw/quicklook/trials/mpl_test.py\", line 33, in __init__\r\n    self._static_ax = static_canvas.figure.subplots()\r\nAttributeError: 'Figure' object has no attribute 'subplots'\r\n\r\n```\r\n\r\n\r\n**Matplotlib version**\r\n<!--Please specify your platform and versions of the relevant libraries you are using:-->\r\n  * Operating system: Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux\r\n  * Matplotlib version: 2.0.0\r\n  * Matplotlib backend: 'Qt5Agg'\r\n  * Python version: 3.5.3 (installed with debian package manager)\r\n"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/375040366","html_url":"https://github.com/matplotlib/matplotlib/issues/10855#issuecomment-375040366","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/10855","id":375040366,"user":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars3.githubusercontent.com/u/199813?v=4","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T18:01:27Z","updated_at":"2018-03-21T18:01:27Z","author_association":"OWNER","body":"`Figure.subplots` is a new feature in 2.1."}}
{"actor":{"display_login":"tacaswell"}}