Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated plot_date calls #58484

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Remove deprecated plot_date calls #58484

merged 2 commits into from
Apr 30, 2024

Conversation

QuLogic
Copy link
Contributor

@QuLogic QuLogic commented Apr 30, 2024

These were deprecated in Matplotlib 3.9.

  • [n/a] closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • [n/a] Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

These were deprecated in Matplotlib 3.9.
@QuLogic
Copy link
Contributor Author

QuLogic commented Apr 30, 2024

There's one more thing for 3.9, but I'm not sure how to best fix it:

__________________ TestDataFramePlots.test_plot_scatter_shape __________________
[gw0] linux -- Python 3.12.3 /usr/bin/python3
self = <pandas.tests.plotting.frame.test_frame.TestDataFramePlots object at 0x7fc62fcb3920>
    def test_plot_scatter_shape(self):
        df = DataFrame(
            np.random.default_rng(2).standard_normal((6, 4)),
            index=list(string.ascii_letters[:6]),
            columns=["x", "y", "z", "four"],
        )
        # GH 6951
>       axes = df.plot(x="x", y="y", kind="scatter", subplots=True)
../../../BUILDROOT/python-pandas-2.2.1-2.fc41.x86_64/usr/lib64/python3.12/site-packages/pandas/tests/plotting/frame/test_frame.py:828: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../BUILDROOT/python-pandas-2.2.1-2.fc41.x86_64/usr/lib64/python3.12/site-packages/pandas/plotting/_core.py:975: in __call__
    return plot_backend.plot(data, x=x, y=y, kind=kind, **kwargs)
../../../BUILDROOT/python-pandas-2.2.1-2.fc41.x86_64/usr/lib64/python3.12/site-packages/pandas/plotting/_matplotlib/__init__.py:71: in plot
    plot_obj.generate()
../../../BUILDROOT/python-pandas-2.2.1-2.fc41.x86_64/usr/lib64/python3.12/site-packages/pandas/plotting/_matplotlib/core.py:503: in generate
    self._make_legend()
../../../BUILDROOT/python-pandas-2.2.1-2.fc41.x86_64/usr/lib64/python3.12/site-packages/pandas/plotting/_matplotlib/core.py:896: in _make_legend
    ax.legend(loc="best")
/usr/lib64/python3.12/site-packages/matplotlib/axes/_axes.py:341: in legend
    handles, labels, kwargs = mlegend._parse_legend_args([self], *args, **kwargs)
/usr/lib64/python3.12/site-packages/matplotlib/legend.py:1364: in _parse_legend_args
    _api.warn_external(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
message = 'No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.'
category = None
    def warn_external(message, category=None):
        """
        `warnings.warn` wrapper that sets *stacklevel* to "outside Matplotlib".
    
        The original emitter of the warning can be obtained by patching this
        function back to `warnings.warn`, i.e. ``_api.warn_external =
        warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
        etc.).
        """
        frame = sys._getframe()
        for stacklevel in itertools.count(1):
            if frame is None:
                # when called in embedded context may hit frame is None
                break
            if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))",
                            # Work around sphinx-gallery not setting __name__.
                            frame.f_globals.get("__name__", "")):
                break
            frame = frame.f_back
        # preemptively break reference cycle between locals and the frame
        del frame
>       warnings.warn(message, category, stacklevel)
E       UserWarning: No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
/usr/lib64/python3.12/site-packages/matplotlib/_api/__init__.py:381: UserWarning

@mroeschke mroeschke added the Visualization plotting label Apr 30, 2024
@mroeschke
Copy link
Member

pre-commit.ci autofix

@mroeschke
Copy link
Member

There's one more thing for 3.9, but I'm not sure how to best fix it:

We don't have (m)any matplotlib experts on the pandas team so I'm not sure either. If this will remain as a UserWarning I think that's OK in the near term to leave (feel free to open a a pandas issue to follow up)

Thanks for proactively addressing these!

@mroeschke mroeschke added this to the 3.0 milestone Apr 30, 2024
@mroeschke mroeschke merged commit c9bc480 into pandas-dev:main Apr 30, 2024
46 checks passed
@mroeschke
Copy link
Member

Thanks @QuLogic

@QuLogic QuLogic deleted the mpl39 branch April 30, 2024 17:58
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* Remove deprecated plot_date calls

These were deprecated in Matplotlib 3.9.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@bnavigator
Copy link
Contributor

There's one more thing for 3.9, but I'm not sure how to best fix it:

We don't have (m)any matplotlib experts on the pandas team so I'm not sure either. If this will remain as a UserWarning I think that's OK in the near term to leave (feel free to open a a pandas issue to follow up)

There is already #58851

WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 22, 2024
* Remove deprecated plot_date calls

These were deprecated in Matplotlib 3.9.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
lithomas1 pushed a commit to lithomas1/pandas that referenced this pull request Sep 12, 2024
* Remove deprecated plot_date calls

These were deprecated in Matplotlib 3.9.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit c9bc480)
@jorisvandenbossche jorisvandenbossche modified the milestones: 3.0, 2.2.3 Sep 12, 2024
lithomas1 added a commit that referenced this pull request Sep 18, 2024
* Backport PR #59065: ENH: Fix Python 3.13 test failures & enable CI

* Remove deprecated plot_date calls (#58484)

* Remove deprecated plot_date calls

These were deprecated in Matplotlib 3.9.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit c9bc480)

* Pick out fastparquet xfails for green CI

* pin pytz to fix test_arrays.py

* more workflow tweaks for pytz and Python 3.13

* fix typing and tune tests for copy on write

* remove WASM stuff

* more arm skips

* go for green

---------

Co-authored-by: Lysandros Nikolaou <[email protected]>
Co-authored-by: Elliott Sales de Andrade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants