Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b31fd9c

Browse filesBrowse files
committed
Deprecate Tick.set_label{1,2}.
... as detailed in the deprecation notice.
1 parent efd66d4 commit b31fd9c
Copy full SHA for b31fd9c

File tree

Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``Tick.set_label1`` and ``Tick.set_label2``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are deprecated. Calling these methods from third-party code usually has no
4+
effect, as the labels are overwritten at draw time by the tick formatter.

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def draw(self, renderer):
291291
renderer.close_group(self.__name__)
292292
self.stale = False
293293

294+
@_api.deprecated("3.8")
294295
def set_label1(self, s):
295296
"""
296297
Set the label1 text.
@@ -304,6 +305,7 @@ def set_label1(self, s):
304305

305306
set_label = set_label1
306307

308+
@_api.deprecated("3.8")
307309
def set_label2(self, s):
308310
"""
309311
Set the label2 text.
@@ -1250,15 +1252,15 @@ def _update_ticks(self):
12501252
major_ticks = self.get_major_ticks(len(major_locs))
12511253
for tick, loc, label in zip(major_ticks, major_locs, major_labels):
12521254
tick.update_position(loc)
1253-
tick.set_label1(label)
1254-
tick.set_label2(label)
1255+
tick.label1.set_text(label)
1256+
tick.label2.set_text(label)
12551257
minor_locs = self.get_minorticklocs()
12561258
minor_labels = self.minor.formatter.format_ticks(minor_locs)
12571259
minor_ticks = self.get_minor_ticks(len(minor_locs))
12581260
for tick, loc, label in zip(minor_ticks, minor_locs, minor_labels):
12591261
tick.update_position(loc)
1260-
tick.set_label1(label)
1261-
tick.set_label2(label)
1262+
tick.label1.set_text(label)
1263+
tick.label2.set_text(label)
12621264
ticks = [*major_ticks, *minor_ticks]
12631265

12641266
view_low, view_high = self.get_view_interval()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.