Spaces:
Running
Running
Commit
路
2f05ff8
1
Parent(s):
f24148c
Adjust Axis Aspect Ratios
Browse files
app.py
CHANGED
|
@@ -242,6 +242,7 @@ def create_table(df_distances):
|
|
| 242 |
def create_figure(dfs, unique_subsets, color_maps, model_name):
|
| 243 |
# Se crea el plot para el embedding reducido (asumiendo que es 2D)
|
| 244 |
fig = figure(width=600, height=600, tools="wheel_zoom,pan,reset,save", active_scroll="wheel_zoom", tooltips=TOOLTIPS, title="")
|
|
|
|
| 245 |
|
| 246 |
# Renderizar datos reales
|
| 247 |
real_renderers = add_dataset_to_fig(fig, dfs["real"], unique_subsets["real"],
|
|
@@ -454,7 +455,7 @@ def compute_global_regression(df_combined, embedding_cols, tsne_params, df_f1, r
|
|
| 454 |
slope = model_global.coef_[0]
|
| 455 |
intercept = model_global.intercept_
|
| 456 |
|
| 457 |
-
scatter_fig = figure(width=600, height=600, tools="pan,wheel_zoom,reset,save",
|
| 458 |
title="Scatter Plot: Distance vs F1")
|
| 459 |
source_colors = {
|
| 460 |
"es-digital-paragraph-degradation-seq": "blue",
|
|
@@ -480,6 +481,7 @@ def compute_global_regression(df_combined, embedding_cols, tsne_params, df_f1, r
|
|
| 480 |
scatter_fig.legend.location = "top_right"
|
| 481 |
hover_tool = HoverTool(tooltips=[("Distance", "@x"), ("F1", "@y"), ("Subset", "@Fuente")])
|
| 482 |
scatter_fig.add_tools(hover_tool)
|
|
|
|
| 483 |
|
| 484 |
x_line = np.linspace(all_x_arr.min(), all_x_arr.max(), 100)
|
| 485 |
y_line = model_global.predict(x_line.reshape(-1, 1))
|
|
@@ -930,6 +932,7 @@ def run_model(model_name):
|
|
| 930 |
show_legend_second = st.checkbox("Show Legend", value=False, key=f"legend_second_{model_name}")
|
| 931 |
fig_all.legend.visible = show_legend_second
|
| 932 |
fig_all.legend.location = "top_right"
|
|
|
|
| 933 |
|
| 934 |
st.bokeh_chart(fig_all)
|
| 935 |
|
|
@@ -983,11 +986,13 @@ def run_model(model_name):
|
|
| 983 |
tools="pan,wheel_zoom,reset,save,hover",
|
| 984 |
active_scroll="wheel_zoom",
|
| 985 |
title="Scatter Plot: Distance vs F1 (Nueva PCA)",
|
| 986 |
-
background_fill_color="white"
|
|
|
|
| 987 |
)
|
| 988 |
# Configurar 煤nicamente grid horizontal
|
| 989 |
scatter_fig_new.xgrid.grid_line_color = None
|
| 990 |
scatter_fig_new.ygrid.grid_line_color = "gray"
|
|
|
|
| 991 |
|
| 992 |
# Mantenemos el mismo c贸digo de colores que en el otro scatter plot
|
| 993 |
source_colors = {
|
|
|
|
| 242 |
def create_figure(dfs, unique_subsets, color_maps, model_name):
|
| 243 |
# Se crea el plot para el embedding reducido (asumiendo que es 2D)
|
| 244 |
fig = figure(width=600, height=600, tools="wheel_zoom,pan,reset,save", active_scroll="wheel_zoom", tooltips=TOOLTIPS, title="")
|
| 245 |
+
fig.match_aspect = True
|
| 246 |
|
| 247 |
# Renderizar datos reales
|
| 248 |
real_renderers = add_dataset_to_fig(fig, dfs["real"], unique_subsets["real"],
|
|
|
|
| 455 |
slope = model_global.coef_[0]
|
| 456 |
intercept = model_global.intercept_
|
| 457 |
|
| 458 |
+
scatter_fig = figure(width=600, height=600, tools="pan,wheel_zoom,reset,save", y_range=(0, 1),
|
| 459 |
title="Scatter Plot: Distance vs F1")
|
| 460 |
source_colors = {
|
| 461 |
"es-digital-paragraph-degradation-seq": "blue",
|
|
|
|
| 481 |
scatter_fig.legend.location = "top_right"
|
| 482 |
hover_tool = HoverTool(tooltips=[("Distance", "@x"), ("F1", "@y"), ("Subset", "@Fuente")])
|
| 483 |
scatter_fig.add_tools(hover_tool)
|
| 484 |
+
# scatter_fig.match_aspect = True
|
| 485 |
|
| 486 |
x_line = np.linspace(all_x_arr.min(), all_x_arr.max(), 100)
|
| 487 |
y_line = model_global.predict(x_line.reshape(-1, 1))
|
|
|
|
| 932 |
show_legend_second = st.checkbox("Show Legend", value=False, key=f"legend_second_{model_name}")
|
| 933 |
fig_all.legend.visible = show_legend_second
|
| 934 |
fig_all.legend.location = "top_right"
|
| 935 |
+
fig_all.match_aspect = True
|
| 936 |
|
| 937 |
st.bokeh_chart(fig_all)
|
| 938 |
|
|
|
|
| 986 |
tools="pan,wheel_zoom,reset,save,hover",
|
| 987 |
active_scroll="wheel_zoom",
|
| 988 |
title="Scatter Plot: Distance vs F1 (Nueva PCA)",
|
| 989 |
+
background_fill_color="white",
|
| 990 |
+
y_range=(0, 1)
|
| 991 |
)
|
| 992 |
# Configurar 煤nicamente grid horizontal
|
| 993 |
scatter_fig_new.xgrid.grid_line_color = None
|
| 994 |
scatter_fig_new.ygrid.grid_line_color = "gray"
|
| 995 |
+
scatter_fig_new.match_aspect = True
|
| 996 |
|
| 997 |
# Mantenemos el mismo c贸digo de colores que en el otro scatter plot
|
| 998 |
source_colors = {
|