[Bug]: canvas.manager.set_window_title does not work to figure with `WebAgg` backend · Issue #29256 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: canvas.manager.set_window_title does not work to figure with WebAgg backend #29256

Description

@YongcaiHuang

Bug summary

canvas.manager.set_window_title does not work to figure with WebAgg backend (but MacOSX). the title is still Figure 1 by default.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
import matplotlib
matplotlib.use("WebAgg")

fig = plt.figure(figsize=(7, 5))
fig.canvas.manager.set_window_title("My figure")
ax = fig.add_subplot(111)

dx, dy = 0.05, 0.05
y, x = np.mgrid[slice(1, 5 + dy, dy),
slice(1, 5 + dx, dx)]
z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)

cf = ax.contourf(x + dx/2., y + dy/2., z)
fig.colorbar(cf, ax=ax)

plt.show()

Actual outcome

image

Expected outcome

image

Additional information

it works in MacOSX backends

image

Operating system

macOS Sequoia 15.1.1

Matplotlib Version

3.9.3

Matplotlib Backend

WebAgg

Python version

3.12.7

Jupyter version

No response

Installation

pip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions