Skip to content

Commit 1269a68

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 b65c501 commit 1269a68

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

plotnine/layer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)