diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index c11d94c381d6d..8a35e5084f55b 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -722,6 +722,11 @@ def __call__(self, *args, **kwargs): ) kind = self._kind_aliases.get(kind, kind) + + # when using another backend, get out of the way + if plot_backend.__name__ != "pandas.plotting._matplotlib": + return plot_backend.plot(self._parent, x=x, y=y, kind=kind, **kwargs) + if kind not in self._all_kinds: raise ValueError("{} is not a valid plot kind".format(kind)) diff --git a/pandas/tests/plotting/test_backend.py b/pandas/tests/plotting/test_backend.py index 41b1a88b15acb..d4035f8eba102 100644 --- a/pandas/tests/plotting/test_backend.py +++ b/pandas/tests/plotting/test_backend.py @@ -86,3 +86,11 @@ def test_setting_backend_without_plot_raises(): def test_no_matplotlib_ok(): with pytest.raises(ImportError): pandas.plotting._core._get_plot_backend("matplotlib") + + +def test_extra_kinds_ok(monkeypatch, restore_backend): + # https://github.com/pandas-dev/pandas/pull/28647 + monkeypatch.setitem(sys.modules, "pandas_dummy_backend", dummy_backend) + pandas.set_option("plotting.backend", "pandas_dummy_backend") + df = pandas.DataFrame({"A": [1, 2, 3]}) + df.plot(kind="not a real kind")