Corey Morris
commited on
Commit
•
f9a0f38
1
Parent(s):
bb08057
Plots have a default title
Browse files
app.py
CHANGED
@@ -113,15 +113,19 @@ def create_plot(df, x_values, y_values, models=None, title=None):
|
|
113 |
|
114 |
plot_data['color'] = 'purple'
|
115 |
fig = px.scatter(plot_data, x=x_values, y=y_values, color='color', hover_data=['Model'], trendline="ols")
|
|
|
|
|
|
|
|
|
|
|
116 |
layout_args = dict(
|
117 |
showlegend=False,
|
118 |
xaxis_title=x_values,
|
119 |
yaxis_title=y_values,
|
120 |
xaxis=dict(),
|
121 |
-
yaxis=dict()
|
|
|
122 |
)
|
123 |
-
if title is not None: # Only set the title if provided
|
124 |
-
layout_args['title'] = title
|
125 |
fig.update_layout(**layout_args)
|
126 |
|
127 |
# Add a dashed line at 0.25 for the y_values
|
|
|
113 |
|
114 |
plot_data['color'] = 'purple'
|
115 |
fig = px.scatter(plot_data, x=x_values, y=y_values, color='color', hover_data=['Model'], trendline="ols")
|
116 |
+
|
117 |
+
# If title is not provided, use x_values vs. y_values as the default title
|
118 |
+
if title is None:
|
119 |
+
title = x_values + " vs. " + y_values
|
120 |
+
|
121 |
layout_args = dict(
|
122 |
showlegend=False,
|
123 |
xaxis_title=x_values,
|
124 |
yaxis_title=y_values,
|
125 |
xaxis=dict(),
|
126 |
+
yaxis=dict(),
|
127 |
+
title=title
|
128 |
)
|
|
|
|
|
129 |
fig.update_layout(**layout_args)
|
130 |
|
131 |
# Add a dashed line at 0.25 for the y_values
|