Gowthamvemula commited on
Commit
6952440
·
verified ·
1 Parent(s): 6a14f39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -140,8 +140,12 @@ with right_col:
140
 
141
  fig = go.Figure()
142
  fig.add_trace(go.Scatter(x=x_range, y=y_range, mode='lines', name='Equation', line=dict(color='#FFD700')))
 
 
143
  x_current, y_current = st.session_state.history[st.session_state.current_index]
144
  fig.add_trace(go.Scatter(x=[x_current], y=[y_current], mode='markers', name='Current Position', marker=dict(size=12, color='#FF4500')))
 
 
145
  tangent_y = calculate_tangent(function_input, x_current, x_range)
146
  fig.add_trace(go.Scatter(x=x_range, y=tangent_y, mode='lines', name='Tangent', line=dict(dash='dash', color='#00FFFF')))
147
 
@@ -154,4 +158,5 @@ with right_col:
154
  width=900,
155
  margin=dict(l=20, r=20, t=50, b=20),
156
  )
 
157
  st.plotly_chart(fig, use_container_width=True)
 
140
 
141
  fig = go.Figure()
142
  fig.add_trace(go.Scatter(x=x_range, y=y_range, mode='lines', name='Equation', line=dict(color='#FFD700')))
143
+
144
+ # Get current position from history
145
  x_current, y_current = st.session_state.history[st.session_state.current_index]
146
  fig.add_trace(go.Scatter(x=[x_current], y=[y_current], mode='markers', name='Current Position', marker=dict(size=12, color='#FF4500')))
147
+
148
+ # Calculate and plot the updated tangent line at the current position
149
  tangent_y = calculate_tangent(function_input, x_current, x_range)
150
  fig.add_trace(go.Scatter(x=x_range, y=tangent_y, mode='lines', name='Tangent', line=dict(dash='dash', color='#00FFFF')))
151
 
 
158
  width=900,
159
  margin=dict(l=20, r=20, t=50, b=20),
160
  )
161
+
162
  st.plotly_chart(fig, use_container_width=True)