-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Scattergl invisible/transparent points #3413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting! Ive transferred over to the fyi plotly.js - |
Could someone try to replicate in JS in a codepen? Thanks for the report. This sounds similar to #2334 |
@Wintermute12, I've used to have a similar issue using What fixed it for me was inspecting my data and making sure I don't have duplicating items in |
@secretwpn Thank you for the suggestion, this sounds very similar to my issue. @etpinard Unfortunately I don't have any experience with JavaScript. Reproducing the plot was not a problem, but I don't know how to properly implement the variable choice (e.g. a dropdown) and replotting in JavaScript. If anyone would like to follow up: the plot (with option to plot either 36 or 4 clusters, as above) can be found at https://codepen.io/anon/pen/NovOad There is also a possibility that the issue arises when data is passed from Python objects into JavaScript (perhaps something gets duplicated as @secretwpn pointed out). In which case it may not be possible to replicate this behaviour in JavaScript alone. |
Another report from #3533 (comment)
|
Can anyone affected by this bug share (at least) their Thank you all! |
Thank you for looking into this, please find a minimal working example below. To see the problem, please run below dash app and click the 'break!' button.
import dash
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
import plotly.graph_objs as go
np.random.seed = 42
size = 10001
df = pd.DataFrame({'x': np.linspace(0, 1, size),
'to_filter': np.random.choice([True, False], size)})
app = dash.Dash(__name__)
app.layout = html.Div(children=[
html.Button('Break!', id='button'),
dcc.Graph(id='broken-scatter')
])
@app.callback(
dash.dependencies.Output('broken-scatter', 'figure'),
[dash.dependencies.Input('button', 'n_clicks')])
def plot_scatter(n_clicks):
to_plot = df[df.to_filter] if n_clicks else df
return {'data': [go.Scattergl(x=to_plot.x, y=to_plot.x, mode='markers')]}
if __name__ == '__main__':
app.run_server(debug=True) Example is tested under the latest version: EDIT: For the non-python/numpy people here: x = y = range between 0 and 1 divided equally in 10001 values. See attached CSV as per request. |
#3413 (comment) in a codepen: https://codepen.io/etpinard/pen/rPRwOy?editors=1010 Thanks @Donnyvdm ! This is in fact a duplicate of #2334 We'll continue the discussion over there. Thank you for your help! |
Hi Everyone,
I am not sure if issue is connected to issue #204: "Can't change number of points displayed in a scattergl", I am sorry for duplicating if this is the case.
I have encountered an unusual behaviour of scattergl (this does not happen with scatter) when called from a dash app. When plotting large number of points (64800 in this example) with many traces (36) the first plot is correct.
However if a plot is updated with a new scattergl object with different traces (e.g 1 or 4 traces) then after coming back to the original 36 traces version some of the point are transparent (points can be detected by hovering), and toggling trace visibility works incorrectly.
Curiously the missing points are within the first trace (1/36) if the switched back from a figure with single trace or with first four traces (1-4/36) if switched back from a figure with 4 traces. If one tries toggling traces afterwards the points are shifted.
I apologize if the explanation is not clear. The following code should reproduce this behaviour. If you flick back and forth between options in the dropdown menu then you should notice the problem.
Thanks a lot for creating such a useful module for python!
Code:
Software:
Platform: MacOS 10.12.16
Browsers tested: Firefox/Safari/Chrome
Python: 3.6.3
Plotly: 3.5.0
Dash: 0.35.1
dash-core-components: 0.42.0
dash-html-components: 0.13.4
dash-renderer: 0.16.1
Flask: 1.0.2
The text was updated successfully, but these errors were encountered: