"tests/vscode:/vscode.git/clone" did not exist on "b78bed1bc5debead116092f429eee51398691fc8"
Unverified Commit cbd95a2d authored by Cyrus Leung's avatar Cyrus Leung Committed by GitHub
Browse files

[Benchmark] Use `sns.relplot` for plotting (#35027)


Signed-off-by: default avatarDarkLight1337 <tlleungac@connect.ust.hk>
parent 970861ac
...@@ -346,27 +346,11 @@ def _plot_fig( ...@@ -346,27 +346,11 @@ def _plot_fig(
else "(All)" else "(All)"
) )
g = sns.FacetGrid(df, row="row_group", col="col_group", height=fig_height)
if row_by and col_by:
g.set_titles("{row_name}\n{col_name}")
elif row_by:
g.set_titles("{row_name}")
elif col_by:
g.set_titles("{col_name}")
else:
g.set_titles("")
if scale_x:
g.set(xscale=scale_x)
if scale_y:
g.set(yscale=scale_y)
if len(curve_by) <= 3: if len(curve_by) <= 3:
hue, style, size, *_ = (*curve_by, None, None, None) hue, style, size, *_ = (*curve_by, None, None, None)
g.map_dataframe( g = sns.relplot(
sns.lineplot, df,
x=var_x, x=var_x,
y=var_y, y=var_y,
hue=hue, hue=hue,
...@@ -374,9 +358,11 @@ def _plot_fig( ...@@ -374,9 +358,11 @@ def _plot_fig(
size=size, size=size,
markers=True, markers=True,
errorbar="sd" if error_bars else None, errorbar="sd" if error_bars else None,
kind="line",
row="row_group",
col="col_group",
height=fig_height,
) )
g.add_legend(title=hue)
else: else:
df["curve_group"] = ( df["curve_group"] = (
pd.concat( pd.concat(
...@@ -387,16 +373,32 @@ def _plot_fig( ...@@ -387,16 +373,32 @@ def _plot_fig(
else "(All)" else "(All)"
) )
g.map_dataframe( g = sns.relplot(
sns.lineplot, df,
x=var_x, x=var_x,
y=var_y, y=var_y,
hue="curve_group", hue="curve_group",
markers=True, markers=True,
errorbar="sd" if error_bars else None, errorbar="sd" if error_bars else None,
kind="line",
row="row_group",
col="col_group",
height=fig_height,
) )
g.add_legend() if row_by and col_by:
g.set_titles("{row_name}\n{col_name}")
elif row_by:
g.set_titles("{row_name}")
elif col_by:
g.set_titles("{col_name}")
else:
g.set_titles("")
if scale_x:
g.set(xscale=scale_x)
if scale_y:
g.set(yscale=scale_y)
g.savefig(fig_path, dpi=fig_dpi) g.savefig(fig_path, dpi=fig_dpi)
plt.close(g.figure) plt.close(g.figure)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment