8000 Merge pull request #22121 from meeseeksmachine/auto-backport-of-pr-22… · matplotlib/matplotlib@ac1b518 · GitHub
[go: up one dir, main page]

Skip to content

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 ac1b518

Browse files
authored
Merge pull request #22121 from meeseeksmachine/auto-backport-of-pr-22116-on-v3.5.x
Backport PR #22116 on branch v3.5.x (FIX: there is no add_text method, fallback to add_artist)
2 parents 8a67a3e + abf4d59 commit ac1b518

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ def tables(self):
14671467

14681468
@property
14691469
def texts(self):
1470-
return self.ArtistList(self, 'texts', 'add_text',
1470+
return self.ArtistList(self, 'texts', 'add_artist',
14711471
valid_types=mtext.Text)
14721472

14731473
def clear(self):

lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7233,6 +7233,24 @@ def test_artist_sublists():
72337233
assert not ax.lines
72347234
assert not ax.tables
72357235

7236+
with pytest.warns(MatplotlibDeprecationWarning,
7237+
match='modification of the Axes.texts property'):
7238+
ax.texts.append(text)
7239+
with pytest.warns(MatplotlibDeprecationWarning,
7240+
match='modification of the Axes.collections property'):
7241+
ax.collections.append(col)
7242+
with pytest.warns(MatplotlibDeprecationWarning,
7243+
match='modification of the Axes.images property'):
7244+
ax.images.append(im)
7245+
with pytest.warns(MatplotlibDeprecationWarning,
7246+
match='modification of the Axes.patches property'):
7247+
ax.patches.append(patch)
7248+
# verify things are back
7249+
assert list(ax.collections) == [col]
7250+
assert list(ax.images) == [im]
7251+
assert list(ax.patches) == [patch]
7252+
assert list(ax.texts) == [text]
7253+
72367254
# Adding items should warn.
72377255
with pytest.warns(MatplotlibDeprecationWarning,
72387256
match='modification of the Axes.lines property'):

0 commit comments

Comments
 (0)
0