trohith89 commited on
Commit
3d9b3b8
·
verified ·
1 Parent(s): b5f2b81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -196,7 +196,7 @@ with col2:
196
  name="Tangent Line"
197
  ))
198
 
199
- # Update layout to include white axis, hide negative y-axis, and adjust legend position
200
  fig.update_layout(
201
  xaxis=dict(
202
  title="x-axis",
@@ -205,6 +205,7 @@ with col2:
205
  zerolinewidth=2,
206
  showgrid=True,
207
  gridcolor="lightgray",
 
208
  color="white"
209
  ),
210
  yaxis=dict(
@@ -214,25 +215,28 @@ with col2:
214
  zerolinewidth=2,
215
  showgrid=True,
216
  gridcolor="lightgray",
217
- range=[0, max(y_plot) + 10], # Limit to non-negative y-axis
218
  color="white"
219
  ),
220
  plot_bgcolor="black",
221
  paper_bgcolor="black",
222
  font=dict(color="white"),
223
  legend=dict(
224
- x=0.65, # Move legend further left to avoid overlap with the right border
225
- y=1.0,
 
 
226
  bgcolor="black",
227
  bordercolor="#001A6E",
228
  borderwidth=2
229
  ),
230
- margin=dict(l=10, r=50, t=10, b=10), # Increase right margin to expand the right border
231
  width=800,
232
  height=400,
233
  showlegend=True
234
  )
235
 
 
236
  st.plotly_chart(fig, use_container_width=True)
237
 
238
  except Exception as e:
 
196
  name="Tangent Line"
197
  ))
198
 
199
+ # Update layout to include full quadrants and reposition the legend
200
  fig.update_layout(
201
  xaxis=dict(
202
  title="x-axis",
 
205
  zerolinewidth=2,
206
  showgrid=True,
207
  gridcolor="lightgray",
208
+ range=[-10, 10], # Adjust x-axis range to show all quadrants
209
  color="white"
210
  ),
211
  yaxis=dict(
 
215
  zerolinewidth=2,
216
  showgrid=True,
217
  gridcolor="lightgray",
218
+ range=[-100, 100], # Adjust y-axis range to show all quadrants
219
  color="white"
220
  ),
221
  plot_bgcolor="black",
222
  paper_bgcolor="black",
223
  font=dict(color="white"),
224
  legend=dict(
225
+ x=0.5, # Center the legend horizontally
226
+ y=1.15, # Position the legend above the plot
227
+ xanchor="center", # Align legend horizontally by its center
228
+ yanchor="bottom", # Align legend vertically by its bottom
229
  bgcolor="black",
230
  bordercolor="#001A6E",
231
  borderwidth=2
232
  ),
233
+ margin=dict(l=10, r=10, t=40, b=10), # Adjust margins to accommodate legend at the top
234
  width=800,
235
  height=400,
236
  showlegend=True
237
  )
238
 
239
+
240
  st.plotly_chart(fig, use_container_width=True)
241
 
242
  except Exception as e: