Skip to content

Commit c1a4fec

Browse files
committed
Better names for plotting functions
1 parent 0cd448a commit c1a4fec

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

gui/app.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import gradio as gr
22
from data import test_equations
3-
from plots import replot, replot_pareto
3+
from plots import plot_example_data, plot_pareto_curve
44
from processing import processing
55

66

@@ -225,7 +225,7 @@ def main():
225225
outputs=blocks["df"],
226226
)
227227

228-
# Any update to the equation choice will trigger a replot:
228+
# Any update to the equation choice will trigger a plot_example_data:
229229
eqn_components = [
230230
blocks["test_equation"],
231231
blocks["num_points"],
@@ -234,17 +234,20 @@ def main():
234234
]
235235
for eqn_component in eqn_components:
236236
eqn_component.change(
237-
replot, eqn_components, blocks["example_plot"], show_progress=False
237+
plot_example_data,
238+
eqn_components,
239+
blocks["example_plot"],
240+
show_progress=False,
238241
)
239242

240243
# Update plot when dataframe is updated:
241244
blocks["df"].change(
242-
replot_pareto,
245+
plot_pareto_curve,
243246
inputs=[blocks["df"], blocks["maxsize"]],
244247
outputs=[blocks["pareto"]],
245248
show_progress=False,
246249
)
247-
demo.load(replot, eqn_components, blocks["example_plot"])
250+
demo.load(plot_example_data, eqn_components, blocks["example_plot"])
248251

249252
demo.launch(debug=True)
250253

gui/plots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from data import generate_data
1515

1616

17-
def replot_pareto(df: pd.DataFrame, maxsize: int):
17+
def plot_pareto_curve(df: pd.DataFrame, maxsize: int):
1818
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
1919

2020
if len(df) == 0 or "Equation" not in df.columns:
@@ -56,7 +56,7 @@ def replot_pareto(df: pd.DataFrame, maxsize: int):
5656
return fig
5757

5858

59-
def replot(test_equation, num_points, noise_level, data_seed):
59+
def plot_example_data(test_equation, num_points, noise_level, data_seed):
6060
X, y = generate_data(test_equation, num_points, noise_level, data_seed)
6161
x = X["x"]
6262

0 commit comments

Comments
 (0)