From 0a023ff43a140c6de1d9025ec525750bbdf92c3a Mon Sep 17 00:00:00 2001 From: abdulwaheedsoudagar Date: Mon, 30 Oct 2023 19:02:56 +0530 Subject: [PATCH] FIX: catplot with redundant hue assignment creates empty legend with title #3537 --- seaborn/categorical.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seaborn/categorical.py b/seaborn/categorical.py index e07491b8bd..80c2478d4f 100644 --- a/seaborn/categorical.py +++ b/seaborn/categorical.py @@ -3102,8 +3102,10 @@ def catplot( y_value = p.variables.get("y") # Obtaining the datatype of hue hue_type = p.var_types.get("hue") - if legend == 'auto' and hue_value in {x_value, y_value} and hue_type != 'numeric': - # Setting the title of hue to None if hue matches "x" or "y", or if the data type of "hue" is numeric. + if legend == 'auto' and hue_value in {x_value, y_value} \ + and hue_type != 'numeric': + # Setting the title of hue to None if hue matches "x" or + # "y", or if the data type of "hue" is numeric. title_hue = None else: title_hue = hue_value