Skip to content

Commit be6baf6

Browse files
committed
Use an explicit skip list for columns ignored during auto-grouping
Instead of deriving the ignored set from the complement of SCALED_AESTHETICS, list the non-aesthetic/special columns directlyl. This allows custom geoms and stats to define aesthetics that affect the grouping.
1 parent c803905 commit be6baf6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plotnine/layer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ._utils import array_kind, check_required_aesthetics, ninteraction
1010
from ._utils.registry import Registry
1111
from .exceptions import PlotnineError
12-
from .mapping.aes import NO_GROUP, SCALED_AESTHETICS, aes, make_labels
12+
from .mapping.aes import NO_GROUP, aes, make_labels
1313
from .mapping.evaluation import evaluate, stage
1414

1515
if typing.TYPE_CHECKING:
@@ -577,7 +577,12 @@ def add_group(data: pd.DataFrame) -> pd.DataFrame:
577577
return data
578578

579579
if "group" not in data:
580-
ignore = data.columns.difference(list(SCALED_AESTHETICS))
580+
# Exclude some "special" aesthetics from contributing towards
581+
# the grouping.
582+
# label - geom_text, geom_label
583+
# geometry - geom_map
584+
# where - geom_ribbon
585+
ignore = ["PANEL", "label", "geometry", "where"]
581586
disc = discrete_columns(data, ignore=ignore)
582587
if disc:
583588
data["group"] = ninteraction(data[disc], drop=True)

0 commit comments

Comments
 (0)