You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now if I were to repeat the same code using scattergl, then I will not not be able to see the histograms anymore and there will be two lines following the crosshair
import plotly.offline as py
import plotly.graph_objs as go
import matplotlib
%matplotlib inline
py.init_notebook_mode()
import numpy as np
t = np.linspace(-1,1.2,2000)
x = (t3)+(0.3*np.random.randn(2000))
y = (t6)+(0.3*np.random.randn(2000))
Scattergl appears to not be working the same as scatter function. I have found two issues when using scattergl.
Here is code demonstrating the issue
Note this code was taken from the tutorial provided here: https://plot.ly/python/2d-density-plots/
Using scatter function will work as expected: There will be no hover info and all plots will appear
import plotly.offline as py
import plotly.graph_objs as go
import matplotlib
%matplotlib inline
py.init_notebook_mode()
import numpy as np
t = np.linspace(-1,1.2,2000)
x = (t3)+(0.3*np.random.randn(2000))
y = (t6)+(0.3*np.random.randn(2000))
trace1 = go.Scatter(
x=x, y=y, mode='markers', name='points',
marker=dict(color='rgb(102,0,0)', size=2, opacity=0.4),
hoverinfo='none'
)
trace2 = go.Histogram2dcontour(
x=x, y=y, name='density', ncontours=20,
colorscale='Hot', reversescale=True, showscale=False,
hoverinfo='none'
)
trace3 = go.Histogram(
x=x, name='x density',
marker=dict(color='rgb(102,0,0)'),
yaxis='y2'
)
trace4 = go.Histogram(
y=y, name='y density', marker=dict(color='rgb(102,0,0)'),
xaxis='x2'
)
data = [trace1, trace2, trace3, trace4]
layout = go.Layout(
showlegend=False,
autosize=False,
width=600,
height=550,
xaxis=dict(
domain=[0, 0.85],
showgrid=False,
zeroline=False
),
yaxis=dict(
domain=[0, 0.85],
showgrid=False,
zeroline=False
),
margin=dict(
t=50
),
hovermode='closest',
bargap=0,
xaxis2=dict(
domain=[0.85, 1],
showgrid=False,
zeroline=False
),
yaxis2=dict(
domain=[0.85, 1],
showgrid=False,
zeroline=False
),
)
fig = go.Figure(data=data, layout=layout)
py.offline.iplot(fig)
Now if I were to repeat the same code using scattergl, then I will not not be able to see the histograms anymore and there will be two lines following the crosshair
import plotly.offline as py
import plotly.graph_objs as go
import matplotlib
%matplotlib inline
py.init_notebook_mode()
import numpy as np
t = np.linspace(-1,1.2,2000)
x = (t3)+(0.3*np.random.randn(2000))
y = (t6)+(0.3*np.random.randn(2000))
trace1 = go.Scattergl(
x=x, y=y, mode='markers', name='points',
marker=dict(color='rgb(102,0,0)', size=2, opacity=0.4),
hoverinfo='none'
)
trace2 = go.Histogram2dcontour(
x=x, y=y, name='density', ncontours=20,
colorscale='Hot', reversescale=True, showscale=False,
hoverinfo='none'
)
trace3 = go.Histogram(
x=x, name='x density',
marker=dict(color='rgb(102,0,0)'),
yaxis='y2'
)
trace4 = go.Histogram(
y=y, name='y density', marker=dict(color='rgb(102,0,0)'),
xaxis='x2'
)
data = [trace1, trace2, trace3, trace4]
layout = go.Layout(
showlegend=False,
autosize=False,
width=600,
height=550,
xaxis=dict(
domain=[0, 0.85],
showgrid=False,
zeroline=False
),
yaxis=dict(
domain=[0, 0.85],
showgrid=False,
zeroline=False
),
margin=dict(
t=50
),
hovermode='closest',
bargap=0,
xaxis2=dict(
domain=[0.85, 1],
showgrid=False,
zeroline=False
),
yaxis2=dict(
domain=[0.85, 1],
showgrid=False,
zeroline=False
),
)
fig = go.Figure(data=data, layout=layout)
py.offline.iplot(fig)
The text was updated successfully, but these errors were encountered: