Skip to content

Commit d134b47

Browse files
jsignellWillAyd
authored andcommitted
ENH: When using another plotting backend, minimize pre-processing (pandas-dev#28647)
1 parent 0485115 commit d134b47

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pandas/plotting/_core.py

+5
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,11 @@ def __call__(self, *args, **kwargs):
776776
)
777777

778778
kind = self._kind_aliases.get(kind, kind)
779+
780+
# when using another backend, get out of the way
781+
if plot_backend.__name__ != "pandas.plotting._matplotlib":
782+
return plot_backend.plot(self._parent, x=x, y=y, kind=kind, **kwargs)
783+
779784
if kind not in self._all_kinds:
780785
raise ValueError("{} is not a valid plot kind".format(kind))
781786

pandas/tests/plotting/test_backend.py

+8
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,11 @@ def test_setting_backend_without_plot_raises():
9494
def test_no_matplotlib_ok():
9595
with pytest.raises(ImportError):
9696
pandas.plotting._core._get_plot_backend("matplotlib")
97+
98+
99+
def test_extra_kinds_ok(monkeypatch, restore_backend):
100+
# https://github.com/pandas-dev/pandas/pull/28647
101+
monkeypatch.setitem(sys.modules, "pandas_dummy_backend", dummy_backend)
102+
pandas.set_option("plotting.backend", "pandas_dummy_backend")
103+
df = pandas.DataFrame({"A": [1, 2, 3]})
104+
df.plot(kind="not a real kind")

0 commit comments

Comments
 (0)