Skip to content

Commit 13f0647

Browse files
committed
Deprecate FigureCanvas.{get,set}_window_title.
This really belongs on the manager, and is a mild footgun on the canvas.
1 parent 6f0b4bc commit 13f0647

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
Deprecations
22
------------
3+
4+
``FigureCanvasBase.get_window_title`` and ``FigureCanvasBase.set_window_title``
5+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+
... are deprecated. Use the corresponding methods on the FigureManager if
7+
using pyplot, or GUI-specific methods if embedding.

examples/specialty_plots/leftventricle_bulleye.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
2828
norm : Normalize or None, optional
2929
Optional argument to normalize data into the [0.0, 1.0] range
3030
31-
3231
Notes
3332
-----
3433
This function create the 17 segment model for the left ventricle according
@@ -135,7 +134,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
135134
# Make a figure and axes with dimensions as desired.
136135
fig, ax = plt.subplots(figsize=(12, 8), nrows=1, ncols=3,
137136
subplot_kw=dict(projection='polar'))
138-
fig.canvas.set_window_title('Left Ventricle Bulls Eyes (AHA)')
137+
fig.canvas.manager.set_window_title('Left Ventricle Bulls Eyes (AHA)')
139138

140139
# Create the axis for the colorbars
141140
axl = fig.add_axes([0.14, 0.15, 0.2, 0.05])

examples/statistics/barchart_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def format_ycursor(y):
6767
def plot_student_results(student, scores, cohort_size):
6868
fig, ax1 = plt.subplots(figsize=(9, 7)) # Create the figure
6969
fig.subplots_adjust(left=0.115, right=0.88)
70-
fig.canvas.set_window_title('Eldorado K-8 Fitness Chart')
70+
fig.canvas.manager.set_window_title('Eldorado K-8 Fitness Chart')
7171

7272
pos = np.arange(len(test_names))
7373

examples/statistics/boxplot_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
]
103103

104104
fig, ax1 = plt.subplots(figsize=(10, 6))
105-
fig.canvas.set_window_title('A Boxplot Example')
105+
fig.canvas.manager.set_window_title('A Boxplot Example')
106106
fig.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25)
107107

108108
bp = ax1.boxplot(data, notch=0, sym='+', vert=1, whis=1.5)

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,8 @@ def get_default_filetype(cls):
22282228
"""
22292229
return rcParams['savefig.format']
22302230

2231+
@cbook.deprecated(
2232+
"3.3", alternative="manager.get_window_title or GUI-specific methods")
22312233
def get_window_title(self):
22322234
"""
22332235
Return the title text of the window containing the figure, or None
@@ -2236,6 +2238,8 @@ def get_window_title(self):
22362238
if self.manager:
22372239
return self.manager.get_window_title()
22382240

2241+
@cbook.deprecated(
2242+
"3.3", alternative="manager.get_window_title or GUI-specific methods")
22392243
def set_window_title(self, title):
22402244
"""
22412245
Set the title text of the window containing the figure. Note that

0 commit comments

Comments
 (0)