From e8b5ffd016171e722d075f87c085e59c6699dc6c Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Sun, 22 Sep 2024 21:01:25 +0100 Subject: [PATCH] use getattr directly --- py-polars/polars/dataframe/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py-polars/polars/dataframe/plotting.py b/py-polars/polars/dataframe/plotting.py index eed8fbc62faf..75a2b92aa09e 100644 --- a/py-polars/polars/dataframe/plotting.py +++ b/py-polars/polars/dataframe/plotting.py @@ -31,9 +31,9 @@ def _maybe_extract_shorthand(encoding: Encoding) -> Encoding: - if isinstance(encoding, alt.SchemaBase) and hasattr(encoding, "shorthand"): + if isinstance(encoding, alt.SchemaBase): # e.g. for `alt.X('x:Q', axis=alt.Axis(labelAngle=30))`, return `'x:Q'` - return encoding.shorthand + return getattr(encoding, "shorthand", encoding) return encoding