Skip to content

Commit

Permalink
hotfix: diagonal line
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhou committed Apr 8, 2024
1 parent c9377fd commit 9ec86e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions code/util/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,14 @@ def _add_agg(df_this, x_name, y_name, group, aggr_method, if_use_x_quantile, q_q

# Add a diagonal line first
if if_show_diagonal:
_min = df[x_name].values.ravel().min()
_max = df[y_name].values.ravel().max()
_min = np.nanmin(df[x_name].values.ravel())
_max = np.nanmax(df[y_name].values.ravel())
fig.add_trace(go.Scattergl(x=[_min, _max],
y=[_min, _max],
mode='lines',
line=dict(dash='dash', color='black', width=2),
showlegend=False)
name='x=y',
showlegend=True)
)

for i, group in enumerate(df.sort_values(group_by)[group_by].unique()):
Expand Down

0 comments on commit 9ec86e6

Please sign in to comment.