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

Commitcbd7523

Browse files
authored
Merge pull request#29697 from rcomer/remove-plot_date
MNT: remove `plot_date`
2 parents03b74ea +a07d52c commitcbd7523

File tree

18 files changed

+16
-221
lines changed

18 files changed

+16
-221
lines changed

‎doc/api/axes_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Basic
5454
Axes.errorbar
5555
Axes.scatter
5656

57-
Axes.plot_date
5857
Axes.step
5958

6059
Axes.loglog
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``plot_date``
2+
~~~~~~~~~~~~~
3+
4+
Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and deprecated
5+
since 3.9. The ``plot_date`` function has now been removed.
6+
7+
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.
8+
- If you need to plot plain numeric data as:ref:`date-format` or need to set
9+
a timezone, call ``ax.xaxis.axis_date`` / ``ax.yaxis.axis_date`` before
10+
`~.Axes.plot`. See `.Axis.axis_date`.

‎doc/api/prev_api_changes/api_changes_1.4.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Code changes
139139
``matplotlib.testing.image_util.autocontrast``. These will be removed
140140
completely in v1.5.0.
141141

142-
* The ``fmt`` argument of:meth:`~matplotlib.axes.Axes.plot_date` has been
142+
* The ``fmt`` argument of``Axes.plot_date`` has been
143143
changed from ``bo`` to just ``o``, so color cycling can happen by default.
144144

145145
* Removed the class ``FigureManagerQTAgg`` and deprecated

‎doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type. See their documentation for the types they expect.
4747
Discouraged: ``plot_date``
4848
~~~~~~~~~~~~~~~~~~~~~~~~~~
4949

50-
The use of `~.Axes.plot_date` is discouraged. This method exists for historic
50+
The use of ``plot_date`` is discouraged. This method exists for historic
5151
reasons and may be deprecated in the future.
5252

5353
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.

‎doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Deprecations
44
``plot_date``
55
^^^^^^^^^^^^^
66

7-
Use of `~.Axes.plot_date` has been discouraged since Matplotlib 3.5 and the function is
7+
Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and the function is
88
now formally deprecated.
99

1010
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.

‎doc/api/pyplot_summary.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Basic
5151
plot
5252
errorbar
5353
scatter
54-
plot_date
5554
step
5655
loglog
5756
semilogx

‎lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,87 +1778,6 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
17781778
self._request_autoscale_view("y")
17791779
returnlines
17801780

1781-
@_api.deprecated("3.9",alternative="plot")
1782-
@_preprocess_data(replace_names=["x","y"],label_namer="y")
1783-
@_docstring.interpd
1784-
defplot_date(self,x,y,fmt='o',tz=None,xdate=True,ydate=False,
1785-
**kwargs):
1786-
"""
1787-
Plot coercing the axis to treat floats as dates.
1788-
1789-
.. deprecated:: 3.9
1790-
1791-
This method exists for historic reasons and will be removed in version 3.11.
1792-
1793-
- ``datetime``-like data should directly be plotted using
1794-
`~.Axes.plot`.
1795-
- If you need to plot plain numeric data as :ref:`date-format` or
1796-
need to set a timezone, call ``ax.xaxis.axis_date`` /
1797-
``ax.yaxis.axis_date`` before `~.Axes.plot`. See
1798-
`.Axis.axis_date`.
1799-
1800-
Similar to `.plot`, this plots *y* vs. *x* as lines or markers.
1801-
However, the axis labels are formatted as dates depending on *xdate*
1802-
and *ydate*. Note that `.plot` will work with `datetime` and
1803-
`numpy.datetime64` objects without resorting to this method.
1804-
1805-
Parameters
1806-
----------
1807-
x, y : array-like
1808-
The coordinates of the data points. If *xdate* or *ydate* is
1809-
*True*, the respective values *x* or *y* are interpreted as
1810-
:ref:`Matplotlib dates <date-format>`.
1811-
1812-
fmt : str, optional
1813-
The plot format string. For details, see the corresponding
1814-
parameter in `.plot`.
1815-
1816-
tz : timezone string or `datetime.tzinfo`, default: :rc:`timezone`
1817-
The time zone to use in labeling dates.
1818-
1819-
xdate : bool, default: True
1820-
If *True*, the *x*-axis will be interpreted as Matplotlib dates.
1821-
1822-
ydate : bool, default: False
1823-
If *True*, the *y*-axis will be interpreted as Matplotlib dates.
1824-
1825-
Returns
1826-
-------
1827-
list of `.Line2D`
1828-
Objects representing the plotted data.
1829-
1830-
Other Parameters
1831-
----------------
1832-
data : indexable object, optional
1833-
DATA_PARAMETER_PLACEHOLDER
1834-
**kwargs
1835-
Keyword arguments control the `.Line2D` properties:
1836-
1837-
%(Line2D:kwdoc)s
1838-
1839-
See Also
1840-
--------
1841-
matplotlib.dates : Helper functions on dates.
1842-
matplotlib.dates.date2num : Convert dates to num.
1843-
matplotlib.dates.num2date : Convert num to dates.
1844-
matplotlib.dates.drange : Create an equally spaced sequence of dates.
1845-
1846-
Notes
1847-
-----
1848-
If you are using custom date tickers and formatters, it may be
1849-
necessary to set the formatters/locators after the call to
1850-
`.plot_date`. `.plot_date` will set the default tick locator to
1851-
`.AutoDateLocator` (if the tick locator is not already set to a
1852-
`.DateLocator` instance) and the default tick formatter to
1853-
`.AutoDateFormatter` (if the tick formatter is not already set to a
1854-
`.DateFormatter` instance).
1855-
"""
1856-
ifxdate:
1857-
self.xaxis_date(tz)
1858-
ifydate:
1859-
self.yaxis_date(tz)
1860-
returnself.plot(x,y,fmt,**kwargs)
1861-
18621781
# @_preprocess_data() # let 'plot' do the unpacking..
18631782
@_docstring.interpd
18641783
defloglog(self,*args,**kwargs):

‎lib/matplotlib/axes/_axes.pyi

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,6 @@ class Axes(_AxesBase):
200200
data=...,
201201
**kwargs
202202
)->list[Line2D]: ...
203-
defplot_date(
204-
self,
205-
x:ArrayLike,
206-
y:ArrayLike,
207-
fmt:str= ...,
208-
tz:str|datetime.tzinfo|None= ...,
209-
xdate:bool= ...,
210-
ydate:bool= ...,
211-
*,
212-
data=...,
213-
**kwargs
214-
)->list[Line2D]: ...
215203
defloglog(self,*args,**kwargs)->list[Line2D]: ...
216204
defsemilogx(self,*args,**kwargs)->list[Line2D]: ...
217205
defsemilogy(self,*args,**kwargs)->list[Line2D]: ...

‎lib/matplotlib/pyplot.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686

8787
ifTYPE_CHECKING:
8888
fromcollections.abcimportCallable,Hashable,Iterable,Sequence
89-
importdatetime
9089
importpathlib
9190
importos
9291
fromtypingimportAny,BinaryIO,Literal,TypeVar
@@ -3834,31 +3833,6 @@ def plot(
38343833
)
38353834

38363835

3837-
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3838-
@_copy_docstring_and_deprecators(Axes.plot_date)
3839-
defplot_date(
3840-
x:ArrayLike,
3841-
y:ArrayLike,
3842-
fmt:str="o",
3843-
tz:str|datetime.tzinfo|None=None,
3844-
xdate:bool=True,
3845-
ydate:bool=False,
3846-
*,
3847-
data=None,
3848-
**kwargs,
3849-
)->list[Line2D]:
3850-
returngca().plot_date(
3851-
x,
3852-
y,
3853-
fmt=fmt,
3854-
tz=tz,
3855-
xdate=xdate,
3856-
ydate=ydate,
3857-
**({"data":data}ifdataisnotNoneelse {}),
3858-
**kwargs,
3859-
)
3860-
3861-
38623836
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
38633837
@_copy_docstring_and_deprecators(Axes.psd)
38643838
defpsd(
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

‎lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -895,22 +895,6 @@ def test_single_point():
895895
ax2.plot('b','b','o',data=data)
896896

897897

898-
@image_comparison(['single_date.png'],style='mpl20')
899-
deftest_single_date():
900-
901-
# use former defaults to match existing baseline image
902-
plt.rcParams['axes.formatter.limits']=-7,7
903-
dt=mdates.date2num(np.datetime64('0000-12-31'))
904-
905-
time1= [721964.0]
906-
data1= [-65.54]
907-
908-
fig,ax=plt.subplots(2,1)
909-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
910-
ax[0].plot_date(time1+dt,data1,'o',color='r')
911-
ax[1].plot(time1,data1,'o',color='r')
912-
913-
914898
@check_figures_equal(extensions=["png"])
915899
deftest_shaped_data(fig_test,fig_ref):
916900
row=np.arange(10).reshape((1,-1))
@@ -7299,63 +7283,6 @@ def test_bar_uint8():
72997283
assertpatch.xy[0]==x
73007284

73017285

7302-
@image_comparison(['date_timezone_x.png'],tol=1.0)
7303-
deftest_date_timezone_x():
7304-
# Tests issue 5575
7305-
time_index= [datetime.datetime(2016,2,22,hour=x,
7306-
tzinfo=dateutil.tz.gettz('Canada/Eastern'))
7307-
forxinrange(3)]
7308-
7309-
# Same Timezone
7310-
plt.figure(figsize=(20,12))
7311-
plt.subplot(2,1,1)
7312-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7313-
plt.plot_date(time_index, [3]*3,tz='Canada/Eastern')
7314-
7315-
# Different Timezone
7316-
plt.subplot(2,1,2)
7317-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7318-
plt.plot_date(time_index, [3]*3,tz='UTC')
7319-
7320-
7321-
@image_comparison(['date_timezone_y.png'])
7322-
deftest_date_timezone_y():
7323-
# Tests issue 5575
7324-
time_index= [datetime.datetime(2016,2,22,hour=x,
7325-
tzinfo=dateutil.tz.gettz('Canada/Eastern'))
7326-
forxinrange(3)]
7327-
7328-
# Same Timezone
7329-
plt.figure(figsize=(20,12))
7330-
plt.subplot(2,1,1)
7331-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7332-
plt.plot_date([3]*3,time_index,tz='Canada/Eastern',xdate=False,ydate=True)
7333-
7334-
# Different Timezone
7335-
plt.subplot(2,1,2)
7336-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7337-
plt.plot_date([3]*3,time_index,tz='UTC',xdate=False,ydate=True)
7338-
7339-
7340-
@image_comparison(['date_timezone_x_and_y.png'],tol=1.0)
7341-
deftest_date_timezone_x_and_y():
7342-
# Tests issue 5575
7343-
UTC=datetime.timezone.utc
7344-
time_index= [datetime.datetime(2016,2,22,hour=x,tzinfo=UTC)
7345-
forxinrange(3)]
7346-
7347-
# Same Timezone
7348-
plt.figure(figsize=(20,12))
7349-
plt.subplot(2,1,1)
7350-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7351-
plt.plot_date(time_index,time_index,tz='UTC',ydate=True)
7352-
7353-
# Different Timezone
7354-
plt.subplot(2,1,2)
7355-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
7356-
plt.plot_date(time_index,time_index,tz='US/Eastern',ydate=True)
7357-
7358-
73597286
@image_comparison(['axisbelow.png'],remove_text=True)
73607287
deftest_axisbelow():
73617288
# Test 'line' setting added in 6287.

‎lib/matplotlib/tests/test_datetime.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -642,26 +642,6 @@ def test_plot(self):
642642
ax2.plot(range(1,N),x)
643643
ax3.plot(x,x)
644644

645-
@mpl.style.context("default")
646-
deftest_plot_date(self):
647-
mpl.rcParams["date.converter"]="concise"
648-
range_threshold=10
649-
fig, (ax1,ax2,ax3)=plt.subplots(3,1,layout="constrained")
650-
651-
x_dates=np.array(
652-
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
653-
)
654-
y_dates=np.array(
655-
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
656-
)
657-
x_ranges=np.array(range(1,range_threshold))
658-
y_ranges=np.array(range(1,range_threshold))
659-
660-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
661-
ax1.plot_date(x_dates,y_dates)
662-
ax2.plot_date(x_dates,y_ranges)
663-
ax3.plot_date(x_ranges,y_dates)
664-
665645
@pytest.mark.xfail(reason="Test for quiver not written yet")
666646
@mpl.style.context("default")
667647
deftest_quiver(self):

‎lib/matplotlib/tests/test_pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def extract_documented_functions(lines):
381381
:nosignatures:
382382
383383
plot
384-
plot_date
384+
errorbar
385385
386386
"""
387387
functions= []

‎lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def test_twin_axes_empty_and_removed():
9292

9393
deftest_twin_axes_both_with_units():
9494
host=host_subplot(111)
95-
withpytest.warns(mpl.MatplotlibDeprecationWarning):
96-
host.plot_date([0,1,2], [0,1,2],xdate=False,ydate=True)
95+
host.yaxis.axis_date()
96+
host.plot([0,1,2], [0,1,2])
9797
twin=host.twinx()
9898
twin.plot(["a","b","c"])
9999
asserthost.get_yticklabels()[0].get_text()=="00:00:00"

‎tools/boilerplate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def boilerplate_gen():
256256
'phase_spectrum',
257257
'pie',
258258
'plot',
259-
'plot_date',
260259
'psd',
261260
'quiver',
262261
'quiverkey',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp