From 50daff40125b268acea03e009fe84fe8ee4510c3 Mon Sep 17 00:00:00 2001 From: Hassan Kibirige Date: Mon, 24 Jun 2024 13:15:24 +0300 Subject: [PATCH] Fixed stat_pointdensity with facetting fixes #808 --- doc/changelog.qmd | 3 +++ plotnine/stats/stat.py | 1 + 2 files changed, 4 insertions(+) diff --git a/doc/changelog.qmd b/doc/changelog.qmd index 8bc80681b..dcdf85e1c 100644 --- a/doc/changelog.qmd +++ b/doc/changelog.qmd @@ -30,6 +30,9 @@ title: Changelog - Fix layers 3 and above not to overlap the axis lines if there are any ({{< issue 798 >}}). +- Fix [](:stat:`~plotnine.stat_pointdensity`) to work with facetting. It is + possible aftected other stats. ({{< issue 808 >}}) + ## v0.13.6 (2024-05-09) diff --git a/plotnine/stats/stat.py b/plotnine/stats/stat.py index 73737a98c..6d34e1942 100644 --- a/plotnine/stats/stat.py +++ b/plotnine/stats/stat.py @@ -341,6 +341,7 @@ def compute_panel( stats = [] for _, old in data.groupby("group"): new = cls.compute_group(old, scales, **params) + new.reset_index(drop=True, inplace=True) unique = uniquecols(old) missing = unique.columns.difference(new.columns) idx = [0] * len(new)