diff --git a/doc/api/next_api_changes/behavior/29256_IMT.rst b/doc/api/next_api_changes/behavior/29256_IMT.rst new file mode 100644 index 000000000000..57ec8f68d85c --- /dev/null +++ b/doc/api/next_api_changes/behavior/29256_IMT.rst @@ -0,0 +1,6 @@ +Setting titles of figures using webagg backend +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously when using the ``webagg`` backend the title of a figure was set using +``figure.set_label``. Now it is set using ``figure.canvas.manager.set_window_title`` +which is more consistent with other backends. diff --git a/lib/matplotlib/backends/backend_webagg_core.py b/lib/matplotlib/backends/backend_webagg_core.py index 12906827a466..33490ff66dc5 100644 --- a/lib/matplotlib/backends/backend_webagg_core.py +++ b/lib/matplotlib/backends/backend_webagg_core.py @@ -328,10 +328,8 @@ def handle_toolbar_button(self, event): getattr(self.toolbar, event['name'])() def handle_refresh(self, event): - figure_label = self.figure.get_label() - if not figure_label: - figure_label = f"Figure {self.manager.num}" - self.send_event('figure_label', label=figure_label) + if self.manager: + self.send_event('figure_label', label=self.manager.get_window_title()) self._force_full = True if self.toolbar: # Normal toolbar init would refresh this, but it happens before the
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: