Skip to content

Commit

Permalink
feat: treat boolean color column as categorical (#128)
Browse files Browse the repository at this point in the history
A categorical color column uses discrete colors. Treating a boolean
color column as numeric means it uses a colorscale for values from 0 to
1 even though there are no values between 0 and 1.
  • Loading branch information
mbelak-dtml authored Sep 15, 2023
1 parent f8c1838 commit c577671
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions edvart/report_sections/multivariate_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def parallel_coordinates(
if drop_na:
df = df.dropna()
if color_col is not None:
is_categorical_color = not is_numeric(df[color_col])
is_categorical_color = not is_numeric(df[color_col]) or is_boolean(df[color_col])

if is_categorical_color:
categories = df[color_col].unique()
Expand Down Expand Up @@ -786,7 +786,7 @@ def parallel_categories(
if drop_na:
df = df.dropna()
if color_col is not None:
categorical_color = not is_numeric(df[color_col])
categorical_color = not is_numeric(df[color_col]) or is_boolean(df[color_col])
if categorical_color:
categories = df[color_col].unique()
colorscale = list(discrete_colorscale(len(categories)))
Expand Down

0 comments on commit c577671

Please sign in to comment.