Spaces:
Sleeping
Sleeping
Update pages/40_simpleline.py
Browse files- pages/40_simpleline.py +4 -2
pages/40_simpleline.py
CHANGED
|
@@ -26,15 +26,17 @@ fig.add_shape(type="line", x0=-100, x1=100, y0=1, y1=1,
|
|
| 26 |
fig.add_shape(type="line", x0=-100, x1=100, y0=-1, y1=-1,
|
| 27 |
line=dict(color="blue", width=2, dash="dash"))
|
| 28 |
|
| 29 |
-
# Plot the x
|
| 30 |
fig.add_trace(go.Scatter(x=[x], y=[-1], mode='markers', marker=dict(color='red', size=10), name="X point"))
|
|
|
|
|
|
|
| 31 |
fig.add_trace(go.Scatter(x=[y], y=[1], mode='markers', marker=dict(color='red', size=10), name="Y point"))
|
| 32 |
|
| 33 |
# Update the layout
|
| 34 |
fig.update_layout(
|
| 35 |
title=f'y = {w} * x + {b}',
|
| 36 |
xaxis=dict(range=[-100, 100]),
|
| 37 |
-
yaxis=dict(range=[-2, 2]),
|
| 38 |
showlegend=False,
|
| 39 |
height=400,
|
| 40 |
margin=dict(t=50, b=10)
|
|
|
|
| 26 |
fig.add_shape(type="line", x0=-100, x1=100, y0=-1, y1=-1,
|
| 27 |
line=dict(color="blue", width=2, dash="dash"))
|
| 28 |
|
| 29 |
+
# Plot the x point
|
| 30 |
fig.add_trace(go.Scatter(x=[x], y=[-1], mode='markers', marker=dict(color='red', size=10), name="X point"))
|
| 31 |
+
|
| 32 |
+
# Plot the y point
|
| 33 |
fig.add_trace(go.Scatter(x=[y], y=[1], mode='markers', marker=dict(color='red', size=10), name="Y point"))
|
| 34 |
|
| 35 |
# Update the layout
|
| 36 |
fig.update_layout(
|
| 37 |
title=f'y = {w} * x + {b}',
|
| 38 |
xaxis=dict(range=[-100, 100]),
|
| 39 |
+
yaxis=dict(range=[-2, 2], showticklabels=False),
|
| 40 |
showlegend=False,
|
| 41 |
height=400,
|
| 42 |
margin=dict(t=50, b=10)
|