Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid errors when changing data by checking variables #45

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions xiplot/plots/boxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def render(
if y_axis is None:
return placeholder_figure("Please select y axis")
df = merge_df_aux(df, aux).reset_index(names="__Xiplot_index__")
if x_axis not in df.columns:
return placeholder_figure("Please select x axis")
if color not in df.columns:
color = None
if plot == "Box plot":
Expand Down
4 changes: 2 additions & 2 deletions xiplot/plots/distplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def render(
hover=None,
template=None,
):
if variable is None:
return placeholder_figure("Please select a variable")
df = merge_df_aux(df, aux).reset_index(names="__Xiplot_index__")
if variable not in df.columns:
return placeholder_figure("Please select a variable")
if color not in df.columns:
fig = ff.create_distplot(
[df[variable]], [variable], show_hist=False
Expand Down
4 changes: 2 additions & 2 deletions xiplot/plots/lineplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def render(
hover=None,
template=None,
):
if x_axis is None or y_axis is None:
return placeholder_figure("Please select x and y axis")
df = merge_df_aux(df, aux).reset_index(names="__Xiplot_index__")
if x_axis not in df.columns or y_axis not in df.columns:
return placeholder_figure("Please select x and y axis")
if color not in df.columns:
color = None
fig = px.line(
Expand Down