Skip to content

Commit

Permalink
Hopefully the last time to fix this edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Aug 12, 2024
1 parent d220352 commit cfcfb33
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/gear/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,20 +472,16 @@ def generate_plot(df, x=None, y=None, z=None, facet_row=None, facet_col=None,
facet_col_groups = []

if facet_row:
facet_row_groups = category_orders[facet_row] if facet_row in category_orders else df[facet_row].unique()
facet_row_groups = category_orders[facet_row] if facet_row in category_orders else df[facet_row].unique().tolist()

if facet_col:
facet_col_groups = category_orders[facet_col] if facet_col in category_orders else df[facet_col].unique()
facet_col_groups = category_orders[facet_col] if facet_col in category_orders else df[facet_col].unique().tolist()

facet_row_indexes = {group: idx for idx, group in enumerate(facet_row_groups, start=1)}
num_rows = len(facet_row_groups) if facet_row else 1
facet_col_indexes = {group: idx for idx, group in enumerate(facet_col_groups, start=1)}
num_cols = len(facet_col_groups) if facet_col else 1

# Ensure facet_row_groups and facet_col_groups elements are cast as strings
facet_row_groups = [str(group) for group in facet_row_groups]
facet_col_groups = [str(group) for group in facet_col_groups]

# Make faceted plot
fig = make_subplots(rows=num_rows
, cols=num_cols
Expand Down

0 comments on commit cfcfb33

Please sign in to comment.