Skip to content

Commit f308421

Browse files
committed
DOC: Turn deprecation alternatives into doc references
where possible
1 parent 03cdb62 commit f308421

File tree

9 files changed

+30
-29
lines changed

9 files changed

+30
-29
lines changed

lib/matplotlib/axis.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _apply_tickdir(self, tickdir):
211211
self._tickdir = tickdir
212212
self._pad = self._base_pad + self.get_tick_padding()
213213

214-
@_api.deprecated("3.5", alternative="axis.set_tick_params")
214+
@_api.deprecated("3.5", alternative="`.Axis.set_tick_params`")
215215
def apply_tickdir(self, tickdir):
216216
self._apply_tickdir(tickdir)
217217
self.stale = True
@@ -822,7 +822,7 @@ def clear(self):
822822
self.set_units(None)
823823
self.stale = True
824824

825-
@_api.deprecated("3.4", alternative="Axis.clear()")
825+
@_api.deprecated("3.4", alternative="`.Axis.clear`")
826826
def cla(self):
827827
"""Clear this axis."""
828828
return self.clear()

lib/matplotlib/backend_bases.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2280,8 +2280,8 @@ def get_default_filetype(cls):
22802280
"""
22812281
return rcParams['savefig.format']
22822282

2283-
@_api.deprecated(
2284-
"3.4", alternative="manager.get_window_title or GUI-specific methods")
2283+
@_api.deprecated("3.4", alternative="`.FigureManagerBase.get_window_title`"
2284+
" or GUI-specific methods")
22852285
def get_window_title(self):
22862286
"""
22872287
Return the title text of the window containing the figure, or None
@@ -2290,8 +2290,8 @@ def get_window_title(self):
22902290
if self.manager is not None:
22912291
return self.manager.get_window_title()
22922292

2293-
@_api.deprecated(
2294-
"3.4", alternative="manager.set_window_title or GUI-specific methods")
2293+
@_api.deprecated("3.4", alternative="`.FigureManagerBase.set_window_title`"
2294+
" or GUI-specific methods")
22952295
def set_window_title(self, title):
22962296
"""
22972297
Set the title text of the window containing the figure. Note that
@@ -3223,7 +3223,7 @@ def save_figure(self, *args):
32233223
"""Save the current figure."""
32243224
raise NotImplementedError
32253225

3226-
@_api.deprecated("3.5", alternative="canvas.set_cursor")
3226+
@_api.deprecated("3.5", alternative="`.FigureCanvasBase.set_cursor`")
32273227
def set_cursor(self, cursor):
32283228
"""
32293229
Set the current cursor to one of the :class:`Cursors` enums values.

lib/matplotlib/backend_tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def _set_cursor_cbk(self, event):
309309
self.canvas.set_cursor(self._default_cursor)
310310
self._last_cursor = self._default_cursor
311311

312-
@_api.deprecated("3.5", alternative="figure.canvas.set_cursor")
312+
@_api.deprecated("3.5", alternative="`.FigureCanvasBase.set_cursor`")
313313
def set_cursor(self, cursor):
314314
"""
315315
Set the cursor.

lib/matplotlib/collections.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,8 @@ def get_coordinates(self):
20762076
return self._coordinates
20772077

20782078
@staticmethod
2079-
@_api.deprecated("3.5", alternative="QuadMesh(coordinates).get_paths()")
2079+
@_api.deprecated("3.5", alternative="`QuadMesh(coordinates).get_paths()"
2080+
" <.QuadMesh.get_paths>`")
20802081
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
20812082
return QuadMesh._convert_mesh_to_paths(coordinates)
20822083

lib/matplotlib/colorbar.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1589,12 +1589,12 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
15891589
return cax, kwargs
15901590

15911591

1592-
@_api.deprecated("3.4", alternative="Colorbar")
1592+
@_api.deprecated("3.4", alternative="`.Colorbar`")
15931593
class ColorbarPatch(Colorbar):
15941594
pass
15951595

15961596

1597-
@_api.deprecated("3.4", alternative="Colorbar")
1597+
@_api.deprecated("3.4", alternative="`.Colorbar`")
15981598
def colorbar_factory(cax, mappable, **kwargs):
15991599
"""
16001600
Create a colorbar on the given axes for the given mappable.

lib/matplotlib/dates.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1681,12 +1681,12 @@ def set_axis(self, axis):
16811681
self._wrapped_locator.set_axis(axis)
16821682
return super().set_axis(axis)
16831683

1684-
@_api.deprecated("3.5", alternative=".axis.set_view_interval")
1684+
@_api.deprecated("3.5", alternative="`.Axis.set_view_interval`")
16851685
def set_view_interval(self, vmin, vmax):
16861686
self._wrapped_locator.set_view_interval(vmin, vmax)
16871687
return super().set_view_interval(vmin, vmax)
16881688

1689-
@_api.deprecated("3.5", alternative=".axis.set_data_interval")
1689+
@_api.deprecated("3.5", alternative="`.Axis.set_data_interval`")
16901690
def set_data_interval(self, vmin, vmax):
16911691
self._wrapped_locator.set_data_interval(vmin, vmax)
16921692
return super().set_data_interval(vmin, vmax)
@@ -1722,8 +1722,8 @@ def _get_interval(self):
17221722
return self._interval
17231723

17241724

1725-
@_api.deprecated("3.5",
1726-
alternative="mdates.date2num(datetime.utcfromtimestamp(e))")
1725+
@_api.deprecated("3.5", alternative="" +
1726+
"`date2num(datetime.utcfromtimestamp(e)) <.date2num>`")
17271727
def epoch2num(e):
17281728
"""
17291729
Convert UNIX time to days since Matplotlib epoch.
@@ -1745,7 +1745,7 @@ def epoch2num(e):
17451745
return (dt + np.asarray(e)) / SEC_PER_DAY
17461746

17471747

1748-
@_api.deprecated("3.5", alternative="mdates.num2date(e).timestamp()")
1748+
@_api.deprecated("3.5", alternative="`num2date(e).timestamp() <.num2date>`")
17491749
def num2epoch(d):
17501750
"""
17511751
Convert days since Matplotlib epoch to UNIX time.

lib/matplotlib/mathtext.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ def get_hinting_type(self):
179179
return backend_agg.get_hinting_flag()
180180

181181

182-
@_api.deprecated("3.4", alternative="mathtext.math_to_image")
182+
@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`")
183183
class MathtextBackendBitmap(MathtextBackendAgg):
184184
def get_results(self, box, used_characters):
185185
ox, oy, width, height, depth, image, characters = \
186186
super().get_results(box, used_characters)
187187
return image, depth
188188

189189

190-
@_api.deprecated("3.4", alternative="MathtextBackendPath")
190+
@_api.deprecated("3.4", alternative="`.MathtextBackendPath`")
191191
class MathtextBackendPs(MathtextBackend):
192192
"""
193193
Store information to write a mathtext rendering to the PostScript backend.
@@ -231,7 +231,7 @@ def get_results(self, box, used_characters):
231231
used_characters)
232232

233233

234-
@_api.deprecated("3.4", alternative="MathtextBackendPath")
234+
@_api.deprecated("3.4", alternative="`.MathtextBackendPath`")
235235
class MathtextBackendPdf(MathtextBackend):
236236
"""Store information to write a mathtext rendering to the PDF backend."""
237237

@@ -263,7 +263,7 @@ def get_results(self, box, used_characters):
263263
used_characters)
264264

265265

266-
@_api.deprecated("3.4", alternative="MathtextBackendPath")
266+
@_api.deprecated("3.4", alternative="`.MathtextBackendPath`")
267267
class MathtextBackendSvg(MathtextBackend):
268268
"""
269269
Store information to write a mathtext rendering to the SVG
@@ -324,7 +324,7 @@ def get_results(self, box, used_characters):
324324
self.rects)
325325

326326

327-
@_api.deprecated("3.4", alternative="MathtextBackendPath")
327+
@_api.deprecated("3.4", alternative="`.MathtextBackendPath`")
328328
class MathtextBackendCairo(MathtextBackend):
329329
"""
330330
Store information to write a mathtext rendering to the Cairo
@@ -457,7 +457,7 @@ def _parse_cached(self, s, dpi, prop, force_standard_ps_fonts):
457457
font_output.set_canvas_size(box.width, box.height, box.depth)
458458
return font_output.get_results(box)
459459

460-
@_api.deprecated("3.4", alternative="mathtext.math_to_image")
460+
@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`")
461461
def to_mask(self, texstr, dpi=120, fontsize=14):
462462
r"""
463463
Convert a mathtext string to a grayscale array and depth.
@@ -483,7 +483,7 @@ def to_mask(self, texstr, dpi=120, fontsize=14):
483483
ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop)
484484
return np.asarray(ftimage), depth
485485

486-
@_api.deprecated("3.4", alternative="mathtext.math_to_image")
486+
@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`")
487487
def to_rgba(self, texstr, color='black', dpi=120, fontsize=14):
488488
r"""
489489
Convert a mathtext string to an RGBA array and depth.
@@ -512,7 +512,7 @@ def to_rgba(self, texstr, color='black', dpi=120, fontsize=14):
512512
rgba[:, :, 3] = alpha
513513
return rgba, depth
514514

515-
@_api.deprecated("3.4", alternative="mathtext.math_to_image")
515+
@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`")
516516
def to_png(self, filename, texstr, color='black', dpi=120, fontsize=14):
517517
r"""
518518
Render a tex expression to a PNG file.
@@ -540,7 +540,7 @@ def to_png(self, filename, texstr, color='black', dpi=120, fontsize=14):
540540
Image.fromarray(rgba).save(filename, format="png")
541541
return depth
542542

543-
@_api.deprecated("3.4", alternative="mathtext.math_to_image")
543+
@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`")
544544
def get_depth(self, texstr, dpi=120, fontsize=14):
545545
r"""
546546
Get the depth of a mathtext string.

lib/matplotlib/spines.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def clear(self):
222222
if self.axis is not None:
223223
self.axis.clear()
224224

225-
@_api.deprecated("3.4", alternative="Spine.clear()")
225+
@_api.deprecated("3.4", alternative="`.Spine.clear`")
226226
def cla(self):
227227
self.clear()
228228

lib/matplotlib/ticker.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,17 @@ def create_dummy_axis(self, **kwargs):
187187
if self.axis is None:
188188
self.axis = _DummyAxis(**kwargs)
189189

190-
@_api.deprecated("3.5", alternative=".axis.set_view_interval")
190+
@_api.deprecated("3.5", alternative="`.Axis.set_view_interval`")
191191
def set_view_interval(self, vmin, vmax):
192192
self.axis.set_view_interval(vmin, vmax)
193193

194-
@_api.deprecated("3.5", alternative=".axis.set_data_interval")
194+
@_api.deprecated("3.5", alternative="`.Axis.set_data_interval`")
195195
def set_data_interval(self, vmin, vmax):
196196
self.axis.set_data_interval(vmin, vmax)
197197

198198
@_api.deprecated(
199199
"3.5",
200-
alternative=".axis.set_view_interval and .axis.set_data_interval")
200+
alternative="`.Axis.set_view_interval` and `.Axis.set_data_interval`")
201201
def set_bounds(self, vmin, vmax):
202202
self.set_view_interval(vmin, vmax)
203203
self.set_data_interval(vmin, vmax)

0 commit comments

Comments
 (0)