From 6deb058ff9697b9d27330cc16d40352e2430ff1b Mon Sep 17 00:00:00 2001 From: maximlt Date: Wed, 5 Feb 2025 10:25:25 +0100 Subject: [PATCH] fix calling special plotting methods with the hvplot backend --- hvplot/tests/testplotting.py | 22 ++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 23 insertions(+) diff --git a/hvplot/tests/testplotting.py b/hvplot/tests/testplotting.py index bdf54b139..cf602a036 100644 --- a/hvplot/tests/testplotting.py +++ b/hvplot/tests/testplotting.py @@ -16,6 +16,16 @@ no_args = ['line', 'area', 'hist', 'box', 'kde', 'density', 'bar', 'barh'] x_y = ['scatter', 'hexbin'] +frame_specials = [ + # delegates to boxplot_frame + ('boxplot', hv.BoxWhisker), + # delegates to hist_frame + ('hist', hv.Histogram), +] +series_specials = [ + # delegates to hist_series + ('hist', hv.Histogram) +] no_args_mapping = [ (kind, el) for kind, el in HoloViewsConverter._kind_mapping.items() if kind in no_args @@ -50,6 +60,18 @@ def test_pandas_dataframe_plot_does_not_implement_pie(self): with self.assertRaisesRegex(NotImplementedError, 'pie'): df.plot.pie(y='a') + @parameterized.expand(series_specials) + def test_pandas_series_specials_plot_return_holoviews_object(self, kind, el): + series = pd.Series([0, 1, 2]) + plot = getattr(series, kind)() + self.assertIsInstance(plot, el) + + @parameterized.expand(frame_specials) + def test_pandas_frame_specials_plot_return_holoviews_object(self, kind, el): + df = pd.DataFrame([0, 1, 2]) + plot = getattr(df, kind)() + self.assertIsInstance(plot, el) + class TestPandasHvplotPlotting(TestPandasHoloviewsPlotting): def setUp(self): diff --git a/pyproject.toml b/pyproject.toml index 528d55b29..4b0646d80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ dependencies = [ [project.entry-points."pandas_plotting_backends"] holoviews = "hvplot:plotting" +hvplot = "hvplot:plotting" [project.urls] Homepage = "https://hvplot.holoviz.org"