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 747c2a7

Browse filesBrowse files
authored
Merge pull request #12460 from anntzer/deprecate-renderer-strip-math
Deprecate RendererBase.strip_math.
2 parents 41f28ab + b6dc44f commit 747c2a7
Copy full SHA for 747c2a7

File tree

Expand file treeCollapse file tree

3 files changed

+14
-14
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-14
lines changed
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
The ``backend_bases.RendererBase.strip_math`` method is deprecated. Use
5+
`.cbook.strip_math` instead.

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ def points_to_pixels(self, points):
695695
"""
696696
return points
697697

698+
@cbook.deprecated("3.1", alternative="cbook.strip_math")
698699
def strip_math(self, s):
699700
return cbook.strip_math(s)
700701

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+8-14Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from matplotlib.backend_bases import _has_pil
2222

2323
from matplotlib._pylab_helpers import Gcf
24-
from matplotlib.cbook import is_writable_file_like, warn_deprecated
2524
from matplotlib.figure import Figure
2625
from matplotlib.path import Path
2726
from matplotlib.transforms import Affine2D
@@ -196,15 +195,11 @@ class RendererWx(RendererBase):
196195
}
197196

198197
def __init__(self, bitmap, dpi):
199-
"""
200-
Initialise a wxWindows renderer instance.
201-
"""
202-
warn_deprecated('2.0', message="The WX backend is "
203-
"deprecated. It's untested "
204-
"and will be removed in Matplotlib 3.0. "
205-
"Use the WXAgg backend instead. "
206-
"See Matplotlib usage FAQ for more info on backends.",
207-
alternative='WXAgg')
198+
"""Initialise a wxWindows renderer instance."""
199+
cbook.warn_deprecated(
200+
"2.0", name="wx", obj_type="backend", removal="the future",
201+
alternative="wxagg", addendum="See the Matplotlib usage FAQ for "
202+
"more info on backends.")
208203
RendererBase.__init__(self)
209204
DEBUG_MSG("__init__()", 1, self)
210205
self.width = bitmap.GetWidth()
@@ -225,9 +220,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
225220
get the width and height in display coords of the string s
226221
with FontPropertry prop
227222
"""
228-
# return 1, 1
229223
if ismath:
230-
s = self.strip_math(s)
224+
s = cbook.strip_math(s)
231225

232226
if self.gc is None:
233227
gc = self.new_gc()
@@ -307,7 +301,7 @@ def draw_image(self, gc, x, y, im):
307301

308302
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
309303
if ismath:
310-
s = self.strip_math(s)
304+
s = cbook.strip_math(s)
311305
DEBUG_MSG("draw_text()", 1, self)
312306
gc.select()
313307
self.handle_clip_rectangle(gc)
@@ -1107,7 +1101,7 @@ def _print_image(self, filename, filetype, *args, **kwargs):
11071101
raise RuntimeError(
11081102
'Could not save figure to %s\n' %
11091103
(filename))
1110-
elif is_writable_file_like(filename):
1104+
elif cbook.is_writable_file_like(filename):
11111105
if not isinstance(image, wx.Image):
11121106
image = image.ConvertToImage()
11131107
if not image.SaveStream(filename, filetype):

0 commit comments

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