hysts HF staff commited on
Commit
2a4320e
·
1 Parent(s): 67542c9

Add Show/Hide label button to the graph

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -335,6 +335,23 @@ def plot_size_vs_score(df_filtered: pd.DataFrame) -> go.Figure:
335
  if trace.name != "AVG":
336
  trace.visible = "legendonly"
337
  fig.update_layout(xaxis_range=[0, MAX_MODEL_SIZE * 1.2], yaxis_range=[0, 1])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  return fig
339
 
340
 
 
335
  if trace.name != "AVG":
336
  trace.visible = "legendonly"
337
  fig.update_layout(xaxis_range=[0, MAX_MODEL_SIZE * 1.2], yaxis_range=[0, 1])
338
+ fig.update_layout(
339
+ updatemenus=[
340
+ dict(
341
+ type="buttons",
342
+ direction="left",
343
+ showactive=True,
344
+ buttons=[
345
+ dict(label="Show Labels", method="update", args=[{"mode": ["markers+text"]}]),
346
+ dict(label="Hide Labels", method="update", args=[{"mode": ["markers"]}]),
347
+ ],
348
+ x=0.5,
349
+ y=-0.2,
350
+ xanchor="center",
351
+ yanchor="top",
352
+ )
353
+ ]
354
+ )
355
  return fig
356
 
357