Skip to content

Commit 1b2cbb6

Browse files
committed
ENH: Don't hard code name of geom in warnings
1 parent d88928b commit 1b2cbb6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plotnine/geoms/geom_path.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ def keep(x: Sequence[float]) -> BoolArray:
9696
n2 = len(data)
9797

9898
if n2 != n1 and not self.params["na_rm"]:
99-
msg = "geom_path: Removed {} rows containing missing values."
100-
warn(msg.format(n1 - n2), PlotnineWarning)
99+
geom = self.__class__.__name__
100+
msg = f"{geom}: Removed {n1 - n2} rows containing missing values."
101+
warn(msg, PlotnineWarning)
101102

102103
return data
103104

@@ -109,8 +110,9 @@ def draw_panel(
109110
ax: Axes,
110111
):
111112
if not any(data["group"].duplicated()):
113+
geom = self.__class__.__name__
112114
warn(
113-
"geom_path: Each group consist of only one "
115+
f"{geom}: Each group consist of only one "
114116
"observation. Do you need to adjust the "
115117
"group aesthetic?",
116118
PlotnineWarning,

0 commit comments

Comments
 (0)