Skip to content

Commit 9aa564c

Browse files
committed
Expire deprecations
1 parent 79e7e8b commit 9aa564c

File tree

4 files changed

+9
-286
lines changed

4 files changed

+9
-286
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
pyparsing_common)
2121

2222
import matplotlib as mpl
23-
from . import _api, cbook
23+
from . import cbook
2424
from ._mathtext_data import (
2525
latex_to_bakoma, stix_glyph_fixes, stix_virtual_fonts, tex2uni)
2626
from .font_manager import FontProperties, findfont, get_font
@@ -35,8 +35,7 @@
3535
# FONTS
3636

3737

38-
@_api.delete_parameter("3.6", "math")
39-
def get_unicode_index(symbol, math=False): # Publicly exported.
38+
def get_unicode_index(symbol): # Publicly exported.
4039
r"""
4140
Return the integer index (from the Unicode table) of *symbol*.
4241
@@ -45,17 +44,7 @@ def get_unicode_index(symbol, math=False): # Publicly exported.
4544
symbol : str
4645
A single (Unicode) character, a TeX command (e.g. r'\pi') or a Type1
4746
symbol name (e.g. 'phi').
48-
math : bool, default: False
49-
If True (deprecated), replace ASCII hyphen-minus by Unicode minus.
5047
"""
51-
# From UTF #25: U+2212 minus sign is the preferred
52-
# representation of the unary and binary minus sign rather than
53-
# the ASCII-derived U+002D hyphen-minus, because minus sign is
54-
# unambiguous and because it is rendered with a more desirable
55-
# length, usually longer than a hyphen.
56-
# Remove this block when the 'math' parameter is deleted.
57-
if math and symbol == '-':
58-
return 0x2212
5948
try: # This will succeed if symbol is a single Unicode char
6049
return ord(symbol)
6150
except TypeError:

lib/matplotlib/axis.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,6 @@ def set_clip_path(self, clippath, transform=None):
240240
self.gridline.set_clip_path(clippath, transform)
241241
self.stale = True
242242

243-
@_api.deprecated("3.6")
244-
def get_pad_pixels(self):
245-
return self.figure.dpi * self._base_pad / 72
246-
247243
def contains(self, mouseevent):
248244
"""
249245
Test whether the mouse event occurred in the Tick marks.
@@ -1250,21 +1246,6 @@ def _set_artist_props(self, a):
12501246
return
12511247
a.set_figure(self.figure)
12521248

1253-
@_api.deprecated("3.6")
1254-
def get_ticklabel_extents(self, renderer):
1255-
"""Get the extents of the tick labels on either side of the axes."""
1256-
ticks_to_draw = self._update_ticks()
1257-
tlb1, tlb2 = self._get_ticklabel_bboxes(ticks_to_draw, renderer)
1258-
if len(tlb1):
1259-
bbox1 = mtransforms.Bbox.union(tlb1)
1260-
else:
1261-
bbox1 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
1262-
if len(tlb2):
1263-
bbox2 = mtransforms.Bbox.union(tlb2)
1264-
else:
1265-
bbox2 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
1266-
return bbox1, bbox2
1267-
12681249
def _update_ticks(self):
12691250
"""
12701251
Update ticks (position and labels) using the current data interval of
@@ -2350,29 +2331,6 @@ def _update_offset_text_position(self, bboxes, bboxes2):
23502331
y = top + self.OFFSETTEXTPAD * self.figure.dpi / 72
23512332
self.offsetText.set_position((x, y))
23522333

2353-
@_api.deprecated("3.6")
2354-
def get_text_heights(self, renderer):
2355-
"""
2356-
Return how much space should be reserved for text above and below the
2357-
Axes, as a pair of floats.
2358-
"""
2359-
bbox, bbox2 = self.get_ticklabel_extents(renderer)
2360-
# MGDTODO: Need a better way to get the pad
2361-
pad_pixels = self.majorTicks[0].get_pad_pixels()
2362-
2363-
above = 0.0
2364-
if bbox2.height:
2365-
above += bbox2.height + pad_pixels
2366-
below = 0.0
2367-
if bbox.height:
2368-
below += bbox.height + pad_pixels
2369-
2370-
if self.get_label_position() == 'top':
2371-
above += self.label.get_window_extent(renderer).height + pad_pixels
2372-
else:
2373-
below += self.label.get_window_extent(renderer).height + pad_pixels
2374-
return above, below
2375-
23762334
def set_ticks_position(self, position):
23772335
"""
23782336
Set the ticks position.
@@ -2621,25 +2579,6 @@ def set_offset_position(self, position):
26212579
self.offsetText.set_position((x, y))
26222580
self.stale = True
26232581

2624-
@_api.deprecated("3.6")
2625-
def get_text_widths(self, renderer):
2626-
bbox, bbox2 = self.get_ticklabel_extents(renderer)
2627-
# MGDTODO: Need a better way to get the pad
2628-
pad_pixels = self.majorTicks[0].get_pad_pixels()
2629-
2630-
left = 0.0
2631-
if bbox.width:
2632-
left += bbox.width + pad_pixels
2633-
right = 0.0
2634-
if bbox2.width:
2635-
right += bbox2.width + pad_pixels
2636-
2637-
if self.get_label_position() == 'left':
2638-
left += self.label.get_window_extent(renderer).width + pad_pixels
2639-
else:
2640-
right += self.label.get_window_extent(renderer).width + pad_pixels
2641-
return left, right
2642-
26432582
def set_ticks_position(self, position):
26442583
"""
26452584
Set the ticks position.

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515
metrics for those fonts.
1616
"""
1717

18-
from collections import namedtuple
1918
import functools
2019
import logging
2120

22-
import numpy as np
23-
24-
import matplotlib as mpl
2521
from matplotlib import _api, _mathtext
26-
from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING
22+
from matplotlib.ft2font import LOAD_NO_HINTING
2723
from matplotlib.font_manager import FontProperties
2824
from ._mathtext import ( # noqa: reexported API
2925
RasterParse, VectorParse, get_unicode_index)
@@ -33,151 +29,6 @@
3329

3430
get_unicode_index.__module__ = __name__
3531

36-
37-
@_api.deprecated("3.6")
38-
class MathtextBackend:
39-
"""
40-
The base class for the mathtext backend-specific code. `MathtextBackend`
41-
subclasses interface between mathtext and specific Matplotlib graphics
42-
backends.
43-
44-
Subclasses need to override the following:
45-
46-
- :meth:`render_glyph`
47-
- :meth:`render_rect_filled`
48-
- :meth:`get_results`
49-
50-
And optionally, if you need to use a FreeType hinting style:
51-
52-
- :meth:`get_hinting_type`
53-
"""
54-
def __init__(self):
55-
self.width = 0
56-
self.height = 0
57-
self.depth = 0
58-
59-
def set_canvas_size(self, w, h, d):
60-
"""Set the dimension of the drawing canvas."""
61-
self.width = w
62-
self.height = h
63-
self.depth = d
64-
65-
def render_glyph(self, ox, oy, info):
66-
"""
67-
Draw a glyph described by *info* to the reference point (*ox*,
68-
*oy*).
69-
"""
70-
raise NotImplementedError()
71-
72-
def render_rect_filled(self, x1, y1, x2, y2):
73-
"""
74-
Draw a filled black rectangle from (*x1*, *y1*) to (*x2*, *y2*).
75-
"""
76-
raise NotImplementedError()
77-
78-
def get_results(self, box):
79-
"""
80-
Return a backend-specific tuple to return to the backend after
81-
all processing is done.
82-
"""
83-
raise NotImplementedError()
84-
85-
def get_hinting_type(self):
86-
"""
87-
Get the FreeType hinting type to use with this particular
88-
backend.
89-
"""
90-
return LOAD_NO_HINTING
91-
92-
93-
@_api.deprecated("3.6")
94-
class MathtextBackendAgg(MathtextBackend):
95-
"""
96-
Render glyphs and rectangles to an FTImage buffer, which is later
97-
transferred to the Agg image by the Agg backend.
98-
"""
99-
def __init__(self):
100-
self.ox = 0
101-
self.oy = 0
102-
self.image = None
103-
self.mode = 'bbox'
104-
self.bbox = [0, 0, 0, 0]
105-
super().__init__()
106-
107-
def _update_bbox(self, x1, y1, x2, y2):
108-
self.bbox = [min(self.bbox[0], x1),
109-
min(self.bbox[1], y1),
110-
max(self.bbox[2], x2),
111-
max(self.bbox[3], y2)]
112-
113-
def set_canvas_size(self, w, h, d):
114-
super().set_canvas_size(w, h, d)
115-
if self.mode != 'bbox':
116-
self.image = FT2Image(np.ceil(w), np.ceil(h + max(d, 0)))
117-
118-
def render_glyph(self, ox, oy, info):
119-
if self.mode == 'bbox':
120-
self._update_bbox(ox + info.metrics.xmin,
121-
oy - info.metrics.ymax,
122-
ox + info.metrics.xmax,
123-
oy - info.metrics.ymin)
124-
else:
125-
info.font.draw_glyph_to_bitmap(
126-
self.image, ox, oy - info.metrics.iceberg, info.glyph,
127-
antialiased=mpl.rcParams['text.antialiased'])
128-
129-
def render_rect_filled(self, x1, y1, x2, y2):
130-
if self.mode == 'bbox':
131-
self._update_bbox(x1, y1, x2, y2)
132-
else:
133-
height = max(int(y2 - y1) - 1, 0)
134-
if height == 0:
135-
center = (y2 + y1) / 2.0
136-
y = int(center - (height + 1) / 2.0)
137-
else:
138-
y = int(y1)
139-
self.image.draw_rect_filled(int(x1), y, np.ceil(x2), y + height)
140-
141-
def get_results(self, box):
142-
self.image = None
143-
self.mode = 'render'
144-
return _mathtext.ship(box).to_raster()
145-
146-
def get_hinting_type(self):
147-
from matplotlib.backends import backend_agg
148-
return backend_agg.get_hinting_flag()
149-
150-
151-
@_api.deprecated("3.6")
152-
class MathtextBackendPath(MathtextBackend):
153-
"""
154-
Store information to write a mathtext rendering to the text path
155-
machinery.
156-
"""
157-
158-
_Result = namedtuple("_Result", "width height depth glyphs rects")
159-
160-
def __init__(self):
161-
super().__init__()
162-
self.glyphs = []
163-
self.rects = []
164-
165-
def render_glyph(self, ox, oy, info):
166-
oy = self.height - oy + info.offset
167-
self.glyphs.append((info.font, info.fontsize, info.num, ox, oy))
168-
169-
def render_rect_filled(self, x1, y1, x2, y2):
170-
self.rects.append((x1, self.height - y2, x2 - x1, y2 - y1))
171-
172-
def get_results(self, box):
173-
return _mathtext.ship(box).to_vector()
174-
175-
176-
@_api.deprecated("3.6")
177-
class MathTextWarning(Warning):
178-
pass
179-
180-
18132
##############################################################################
18233
# MAIN
18334

0 commit comments

Comments
 (0)