lcipolina commited on
Commit
c4a2190
·
verified ·
1 Parent(s): 654b9e3

Inverted plots axes for better display

Browse files
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -465,15 +465,28 @@ def create_bar_plot(
465
  title: str,
466
  x_label: str,
467
  y_label: str,
 
468
  ) -> gr.BarPlot:
469
- return gr.BarPlot(
470
- value=data,
471
- x=x_col,
472
- y=y_col,
473
- title=title,
474
- x_label=x_label,
475
- y_label=y_label,
476
- )
 
 
 
 
 
 
 
 
 
 
 
 
477
 
478
  # -----------------------------------------------------------------------------
479
  # Upload handler (save .db files to scripts/results/)
@@ -649,6 +662,7 @@ with gr.Blocks() as interface:
649
  title="Win Rate vs Random Bot",
650
  x_label="LLM Model",
651
  y_label="Win Rate (%)",
 
652
  )
653
 
654
  with gr.Row():
@@ -685,6 +699,7 @@ with gr.Blocks() as interface:
685
  title="Illegal Moves by Model",
686
  x_label="LLM Model",
687
  y_label="# of Illegal Moves",
 
688
  )
689
 
690
  with gr.Row():
 
465
  title: str,
466
  x_label: str,
467
  y_label: str,
468
+ horizontal: bool = False,
469
  ) -> gr.BarPlot:
470
+ """Create a bar plot with optional horizontal orientation."""
471
+ if horizontal:
472
+ # Swap x and y for horizontal bars
473
+ return gr.BarPlot(
474
+ value=data,
475
+ x=y_col, # metrics on x-axis
476
+ y=x_col, # model names on y-axis
477
+ title=title,
478
+ x_label=y_label, # swap labels too
479
+ y_label=x_label,
480
+ )
481
+ else:
482
+ return gr.BarPlot(
483
+ value=data,
484
+ x=x_col,
485
+ y=y_col,
486
+ title=title,
487
+ x_label=x_label,
488
+ y_label=y_label,
489
+ )
490
 
491
  # -----------------------------------------------------------------------------
492
  # Upload handler (save .db files to scripts/results/)
 
662
  title="Win Rate vs Random Bot",
663
  x_label="LLM Model",
664
  y_label="Win Rate (%)",
665
+ horizontal=True,
666
  )
667
 
668
  with gr.Row():
 
699
  title="Illegal Moves by Model",
700
  x_label="LLM Model",
701
  y_label="# of Illegal Moves",
702
+ horizontal=True,
703
  )
704
 
705
  with gr.Row():