MilesCranmer commited on
Commit
f751163
1 Parent(s): 2681c82

Fix formatting of data gen tab

Browse files
Files changed (1) hide show
  1. gui/app.py +27 -20
gui/app.py CHANGED
@@ -166,19 +166,22 @@ def greet(
166
  def _data_layout():
167
  with gr.Tab("Example Data"):
168
  # Plot of the example data:
169
- example_plot = gr.Plot()
170
- test_equation = gr.Radio(
171
- test_equations, value=test_equations[0], label="Test Equation"
172
- )
173
- num_points = gr.Slider(
174
- minimum=10,
175
- maximum=1000,
176
- value=200,
177
- label="Number of Data Points",
178
- step=1,
179
- )
180
- noise_level = gr.Slider(minimum=0, maximum=1, value=0.05, label="Noise Level")
181
- data_seed = gr.Number(value=0, label="Random Seed")
 
 
 
182
  with gr.Tab("Upload Data"):
183
  file_input = gr.File(label="Upload a CSV File")
184
  gr.Markdown(
@@ -353,18 +356,22 @@ def replot(test_equation, num_points, noise_level, data_seed):
353
 
354
  ax.scatter(x, y, alpha=0.7, edgecolors='w', s=50)
355
 
356
- ax.grid(True, which="major", linestyle='--', linewidth=0.5, color='gray', alpha=0.7)
357
- ax.grid(True, which="minor", linestyle=':', linewidth=0.5, color='gray', alpha=0.5)
358
  ax.spines['top'].set_visible(False)
359
  ax.spines['right'].set_visible(False)
360
- ax.spines['bottom'].set_color('gray')
361
- ax.spines['left'].set_color('gray')
362
- ax.tick_params(axis='both', which='major', labelsize=12, direction='out', length=6)
363
- ax.tick_params(axis='both', which='minor', labelsize=10, direction='out', length=4)
 
 
 
 
 
364
  ax.set_xlabel("x")
365
  ax.set_ylabel("y")
 
366
 
367
- fig.tight_layout()
368
  return fig
369
 
370
 
 
166
  def _data_layout():
167
  with gr.Tab("Example Data"):
168
  # Plot of the example data:
169
+ with gr.Row():
170
+ with gr.Column():
171
+ example_plot = gr.Plot()
172
+ with gr.Column():
173
+ test_equation = gr.Radio(
174
+ test_equations, value=test_equations[0], label="Test Equation"
175
+ )
176
+ num_points = gr.Slider(
177
+ minimum=10,
178
+ maximum=1000,
179
+ value=200,
180
+ label="Number of Data Points",
181
+ step=1,
182
+ )
183
+ noise_level = gr.Slider(minimum=0, maximum=1, value=0.05, label="Noise Level")
184
+ data_seed = gr.Number(value=0, label="Random Seed")
185
  with gr.Tab("Upload Data"):
186
  file_input = gr.File(label="Upload a CSV File")
187
  gr.Markdown(
 
356
 
357
  ax.scatter(x, y, alpha=0.7, edgecolors='w', s=50)
358
 
359
+ ax.grid(True, which="both", ls="--", linewidth=0.5, color='gray', alpha=0.5)
 
360
  ax.spines['top'].set_visible(False)
361
  ax.spines['right'].set_visible(False)
362
+
363
+ # Range-frame the plot
364
+ for direction in ['bottom', 'left']:
365
+ ax.spines[direction].set_position(('outward', 10))
366
+
367
+ # Delete far ticks
368
+ ax.tick_params(axis='both', which='major', labelsize=10, direction='out', length=5)
369
+ ax.tick_params(axis='both', which='minor', labelsize=8, direction='out', length=3)
370
+
371
  ax.set_xlabel("x")
372
  ax.set_ylabel("y")
373
+ fig.tight_layout(pad=2)
374
 
 
375
  return fig
376
 
377