Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b16031c

Browse files
authored
Merge pull request #26907 from DHClimber/depreciated
Removal of deprecations for Contour
2 parents aeefb3b + 6355271 commit b16031c

File tree

4 files changed

+16
-47
lines changed

4 files changed

+16
-47
lines changed

doc/api/artist_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Inheritance Diagrams
1212
====================
1313

14-
.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ClabelText matplotlib.contour.ContourSet matplotlib.contour.QuadContourSet matplotlib.figure.FigureBase matplotlib.figure.Figure matplotlib.figure.SubFigure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Annulus matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.StepPatch matplotlib.patches.Wedge matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.projections.polar.RadialAxis matplotlib.projections.polar.RadialTick matplotlib.projections.polar.ThetaAxis matplotlib.projections.polar.ThetaTick matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.tri.TriContourSet
14+
.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ContourSet matplotlib.contour.QuadContourSet matplotlib.figure.FigureBase matplotlib.figure.Figure matplotlib.figure.SubFigure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Annulus matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.StepPatch matplotlib.patches.Wedge matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.projections.polar.RadialAxis matplotlib.projections.polar.RadialTick matplotlib.projections.polar.ThetaAxis matplotlib.projections.polar.ThetaTick matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.tri.TriContourSet
1515
:parts: 1
1616
:private-bases:
1717

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
``contour.ClabelText`` and ``ContourLabeler.set_label_props``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are removed.
4+
5+
Use ``Text(..., transform_rotates_text=True)`` as a replacement for
6+
``contour.ClabelText(...)`` and ``text.set(text=text, color=color,
7+
fontproperties=labeler.labelFontProps, clip_box=labeler.axes.bbox)`` as a
8+
replacement for the ``ContourLabeler.set_label_props(label, text, color)``.
9+
10+
``ContourLabeler`` attributes
11+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12+
The ``labelFontProps``, ``labelFontSizeList``, and ``labelTextsList``
13+
attributes of `.ContourLabeler` have been removed. Use the ``labelTexts``
14+
attribute and the font properties of the corresponding text objects instead.

lib/matplotlib/contour.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@
2626
import matplotlib.transforms as mtransforms
2727

2828

29-
@_api.deprecated("3.7", alternative="Text.set_transform_rotates_text")
30-
class ClabelText(Text):
31-
"""
32-
Unlike the ordinary text, the get_rotation returns an updated
33-
angle in the pixel coordinate assuming that the input rotation is
34-
an angle in data coordinate (or whatever transform set).
35-
"""
36-
37-
def get_rotation(self):
38-
new_angle, = self.get_transform().transform_angles(
39-
[super().get_rotation()], [self.get_position()])
40-
return new_angle
41-
42-
4329
def _contour_labeler_event_handler(cs, inline, inline_spacing, event):
4430
canvas = cs.axes.figure.canvas
4531
is_button = event.name == "button_press_event"
@@ -222,22 +208,6 @@ def clabel(self, levels=None, *,
222208

223209
return cbook.silent_list('text.Text', self.labelTexts)
224210

225-
@_api.deprecated("3.7", alternative="cs.labelTexts[0].get_font()")
226-
@property
227-
def labelFontProps(self):
228-
return self._label_font_props
229-
230-
@_api.deprecated("3.7", alternative=(
231-
"[cs.labelTexts[0].get_font().get_size()] * len(cs.labelLevelList)"))
232-
@property
233-
def labelFontSizeList(self):
234-
return [self._label_font_props.get_size()] * len(self.labelLevelList)
235-
236-
@_api.deprecated("3.7", alternative="cs.labelTexts")
237-
@property
238-
def labelTextsList(self):
239-
return cbook.silent_list('text.Text', self.labelTexts)
240-
241211
def print_label(self, linecontour, labelwidth):
242212
"""Return whether a contour is long enough to hold a label."""
243213
return (len(linecontour) > 10 * labelwidth
@@ -259,14 +229,6 @@ def _get_nth_label_width(self, nth):
259229
figure=fig, fontproperties=self._label_font_props)
260230
.get_window_extent(renderer).width)
261231

262-
@_api.deprecated("3.7", alternative="Artist.set")
263-
def set_label_props(self, label, text, color):
264-
"""Set the label properties - color, fontsize, text."""
265-
label.set_text(text)
266-
label.set_color(color)
267-
label.set_fontproperties(self._label_font_props)
268-
label.set_clip_box(self.axes.bbox)
269-
270232
def get_text(self, lev, fmt):
271233
"""Get the text of the label."""
272234
if isinstance(lev, str):

lib/matplotlib/contour.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ from collections.abc import Callable, Iterable, Sequence
1616
from typing import Literal
1717
from .typing import ColorType
1818

19-
class ClabelText(Text): ...
19+
2020

2121
class ContourLabeler:
2222
labelFmt: str | Formatter | Callable[[float], str] | dict[float, str]
@@ -41,15 +41,8 @@ class ContourLabeler:
4141
rightside_up: bool = ...,
4242
zorder: float | None = ...
4343
) -> list[Text]: ...
44-
@property
45-
def labelFontProps(self) -> FontProperties: ...
46-
@property
47-
def labelFontSizeList(self) -> list[float]: ...
48-
@property
49-
def labelTextsList(self) -> list[Text]: ...
5044
def print_label(self, linecontour: ArrayLike, labelwidth: float) -> bool: ...
5145
def too_close(self, x: float, y: float, lw: float) -> bool: ...
52-
def set_label_props(self, label: Text, text: str, color: ColorType) -> None: ...
5346
def get_text(
5447
self,
5548
lev: float,

0 commit comments

Comments
 (0)