Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitba4a29e

Browse files
committed
Remove deprecated TextWithDash
1 parent303d515 commitba4a29e

File tree

9 files changed

+27
-506
lines changed

9 files changed

+27
-506
lines changed

‎doc/api/artist_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
``matplotlib.artist``
55
*********************
66

7-
.. 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.BrokenBarHCollection 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.figure.Figure 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.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.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.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.CustomCell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.text.TextWithDash
7+
.. 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.BrokenBarHCollection 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.figure.Figure 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.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.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.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.CustomCell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text
88
:parts: 1
99
:private-bases:
1010

‎doc/api/next_api_changes/removals.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ Classes and methods
6868
- ``colorbar.ColorbarBase.get_clim`` (use ``ScalarMappable.get_clim`` instead)
6969
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
7070
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)
71+
72+
- ``text.TextWithDash`` (use ``text.Annotation`` instead)
73+
74+
Arguments
75+
~~~~~~~~~
76+
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``
77+
anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead.

‎doc/api/prev_api_changes/api_changes_3.1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ This has always returned None instead of the requested radius.
10301030
Text
10311031
~~~~
10321032

1033-
- `.text.TextWithDash`
1033+
- ``text.TextWithDash``
10341034
- `.Text.is_math_text`
10351035
- `.TextPath.is_math_text`
10361036
- `.TextPath.text_get_vertices_codes` (As an alternative, construct a new ``TextPath`` object.)

‎examples/text_labels_and_annotations/dashpointlabel.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎lib/matplotlib/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
defines classes for drawing polygons
4949
5050
:mod:`matplotlib.text`
51-
defines the :class:`~matplotlib.text.Text`,
52-
:class:`~matplotlib.text.TextWithDash`, and
51+
defines the :class:`~matplotlib.text.Text` and
5352
:class:`~matplotlib.text.Annotate` classes
5453
5554
:mod:`matplotlib.image`

‎lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,7 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs):
650650
raiseValueError('secondary_yaxis location must be either '
651651
'a float or "left"/"right"')
652652

653-
@cbook._delete_parameter("3.1","withdash")
654-
deftext(self,x,y,s,fontdict=None,withdash=False,**kwargs):
653+
deftext(self,x,y,s,fontdict=None,**kwargs):
655654
"""
656655
Add text to the axes.
657656
@@ -671,10 +670,6 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
671670
A dictionary to override the default text properties. If fontdict
672671
is None, the defaults are determined by your rc parameters.
673672
674-
withdash : bool, default: False
675-
Creates a `~matplotlib.text.TextWithDash` instance instead of a
676-
`~matplotlib.text.Text` instance.
677-
678673
Returns
679674
-------
680675
text : `.Text`
@@ -707,32 +702,15 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
707702
708703
>>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
709704
"""
710-
iffontdictisNone:
711-
fontdict= {}
712-
713705
effective_kwargs= {
714706
'verticalalignment':'baseline',
715707
'horizontalalignment':'left',
716708
'transform':self.transData,
717709
'clip_on':False,
718-
**fontdict,
710+
**(fontdictiffontdictisnotNoneelse {}),
719711
**kwargs,
720712
}
721-
722-
# At some point if we feel confident that TextWithDash
723-
# is robust as a drop-in replacement for Text and that
724-
# the performance impact of the heavier-weight class
725-
# isn't too significant, it may make sense to eliminate
726-
# the withdash kwarg and simply delegate whether there's
727-
# a dash to TextWithDash and dashlength.
728-
729-
if (withdash
730-
andwithdashisnotcbook.deprecation._deprecated_parameter):
731-
t=mtext.TextWithDash(x,y,text=s)
732-
else:
733-
t=mtext.Text(x,y,text=s)
734-
t.update(effective_kwargs)
735-
713+
t=mtext.Text(x,y,text=s,**effective_kwargs)
736714
t.set_clip_path(self.patch)
737715
self._add_text(t)
738716
returnt

‎lib/matplotlib/figure.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
importmatplotlib.legendasmlegend
3434
frommatplotlib.patchesimportRectangle
3535
frommatplotlib.projectionsimportprocess_projection_requirements
36-
frommatplotlib.textimportText,TextWithDash
36+
frommatplotlib.textimportText
3737
frommatplotlib.transformsimport (Affine2D,Bbox,BboxTransformTo,
3838
TransformedBbox)
3939
importmatplotlib._layoutboxaslayoutbox
@@ -1821,9 +1821,8 @@ def legend(self, *args, **kwargs):
18211821
self.stale=True
18221822
returnl
18231823

1824-
@cbook._delete_parameter("3.1","withdash")
18251824
@docstring.dedent_interpd
1826-
deftext(self,x,y,s,fontdict=None,withdash=False,**kwargs):
1825+
deftext(self,x,y,s,fontdict=None,**kwargs):
18271826
"""
18281827
Add text to figure.
18291828
@@ -1843,10 +1842,6 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18431842
passed as *kwargs* override the corresponding ones given in
18441843
*fontdict*.
18451844
1846-
withdash : bool, default: False
1847-
Creates a `~matplotlib.text.TextWithDash` instance instead of a
1848-
`~matplotlib.text.Text` instance.
1849-
18501845
Other Parameters
18511846
----------------
18521847
**kwargs : `~matplotlib.text.Text` properties
@@ -1863,19 +1858,12 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18631858
.Axes.text
18641859
.pyplot.text
18651860
"""
1866-
default=dict(transform=self.transFigure)
1867-
1868-
if (withdash
1869-
andwithdashisnotcbook.deprecation._deprecated_parameter):
1870-
text=TextWithDash(x=x,y=y,text=s)
1871-
else:
1872-
text=Text(x=x,y=y,text=s)
1873-
1874-
text.update(default)
1875-
iffontdictisnotNone:
1876-
text.update(fontdict)
1877-
text.update(kwargs)
1878-
1861+
effective_kwargs= {
1862+
'transform':self.transFigure,
1863+
**(fontdictiffontdictisnotNoneelse {}),
1864+
**kwargs,
1865+
}
1866+
text=Text(x=x,y=y,text=s,**effective_kwargs)
18791867
text.set_figure(self)
18801868
text.stale_callback=_stale_figure_callback
18811869

‎lib/matplotlib/pyplot.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,11 +2096,8 @@ def figimage(
20962096

20972097
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
20982098
@docstring.copy(Figure.text)
2099-
deffigtext(
2100-
x,y,s,fontdict=None,
2101-
withdash=cbook.deprecation._deprecated_parameter,**kwargs):
2102-
returngcf().text(
2103-
x,y,s,fontdict=fontdict,withdash=withdash,**kwargs)
2099+
deffigtext(x,y,s,fontdict=None,**kwargs):
2100+
returngcf().text(x,y,s,fontdict=fontdict,**kwargs)
21042101

21052102

21062103
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@@ -2737,10 +2734,8 @@ def table(
27372734

27382735
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
27392736
@docstring.copy(Axes.text)
2740-
deftext(
2741-
x,y,s,fontdict=None,
2742-
withdash=cbook.deprecation._deprecated_parameter,**kwargs):
2743-
returngca().text(x,y,s,fontdict=fontdict,withdash=withdash,**kwargs)
2737+
deftext(x,y,s,fontdict=None,**kwargs):
2738+
returngca().text(x,y,s,fontdict=fontdict,**kwargs)
27442739

27452740

27462741
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp