Bind the given figure to the tools. Parameters ---------- figure : `.Figure` update_tools : bool, default: True Force tools to update figure.
(self, figure, update_tools=True)
| 76 | self.set_figure(figure) |
| 77 | |
| 78 | def set_figure(self, figure, update_tools=True): |
| 79 | """ |
| 80 | Bind the given figure to the tools. |
| 81 | |
| 82 | Parameters |
| 83 | ---------- |
| 84 | figure : `.Figure` |
| 85 | update_tools : bool, default: True |
| 86 | Force tools to update figure. |
| 87 | """ |
| 88 | if self._key_press_handler_id: |
| 89 | self.canvas.mpl_disconnect(self._key_press_handler_id) |
| 90 | self._figure = figure |
| 91 | if figure: |
| 92 | self._key_press_handler_id = self.canvas.mpl_connect( |
| 93 | 'key_press_event', self._key_press) |
| 94 | if update_tools: |
| 95 | for tool in self._tools.values(): |
| 96 | tool.figure = figure |
| 97 | |
| 98 | def toolmanager_connect(self, s, func): |
| 99 | """ |
no test coverage detected