Reputation: 191
I have a set of scatter points which I want to connect, as shown below. I want to connect the points, but I want to hide the origin while keeping the point (x1, y1). How do I do this?
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1])
Upvotes: 3
Views: 5367
Reputation: 1
You can use mode
parameter to hide markers as follows:
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1], mode="lines")
The API reference of Scatter
states:
mode – Determines the drawing mode for this scatter trace. If the provided mode includes “text” then the text elements appear at the coordinates. Otherwise, the text elements appear on hover. If there are less than 20 points and the trace is not stacked then the default is “lines+markers”. Otherwise, “lines”.
Upvotes: 0
Reputation: 163
fig.add_trace(go.Scatter(x=[0, x1], y=[0, y1], alpha=0)
set alpha between 0 to 1 https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html
Upvotes: -1
Reputation: 1127
You can set the opacity of the markers to a value between 0 and 1; 0 meaning invisible, and 1 meaning totally opaque
fig=go.Figure()
data=[0,1,2]
dot_opacity=np.ones(len(data))
dot_opacity[0]=0
fig.add_trace(go.Scatter(x=[0, 1,3], y=[0, 1,2], marker=dict(opacity=dot_opacity)))
Upvotes: 3