Skip to content
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

Scatter plots do not draw points in the right locations #1046

Closed
chipkent opened this issue Oct 5, 2022 · 9 comments
Closed

Scatter plots do not draw points in the right locations #1046

chipkent opened this issue Oct 5, 2022 · 9 comments
Assignees
Labels
bug Something isn't working external Waiting on an upstream fix
Milestone

Comments

@chipkent
Copy link
Member

chipkent commented Oct 5, 2022

from deephaven import time_table
from deephaven.plot.figure import Figure
from deephaven.plot import PlotStyle
from deephaven.plot import Color, Colors
from deephaven.plot import font_family_names, Font, FontStyle, Shape


data = time_table('00:00:01') \
    .update(["Open = i + 10*random()","High = Open + 1", "Low = Open - 1", "Close = Open + 0.5"])

points = data \
    .where("i%5 = 0") \
    .view(["Timestamp", "Point = i%3==0 ? High : Low"])

# broken
plot = Figure() \
    .figure_title("OHLC + Points")\
    .plot_xy(series_name="OHLC", t=data, x="Timestamp", y_high="High", y_low="Low", y="Close") \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .point(shape=Shape.DIAMOND, size=16, label="Big Triangle",color=Colors.BLUE )\
   .show()

# broken
 plot = Figure() \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .point(shape=Shape.DIAMOND, size=16, label="Big Triangle",color=Colors.BLUE )\
   .show()  

# broken
 plot = Figure() \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
   .show()  

# drawing the line plot works
 plot = Figure() \
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
   .show()  

image

@chipkent chipkent added bug Something isn't working triage Issue requires triage labels Oct 5, 2022
@dsmmcken
Copy link
Contributor

dsmmcken commented Oct 5, 2022

I am unable to replicate this in a clean environment. Point styling isn't supported, but that's unrelated.

image

@mofojed
Copy link
Member

mofojed commented Oct 5, 2022

Seemingly only reproducible on M1 MacBooks. Looking at the data passed into plotly, it looks correct:
image

It appears to be because of the scattergl option, and is a bug in Plotly: plotly/plotly.js#5970

@mofojed
Copy link
Member

mofojed commented Dec 29, 2022

Still an issue with the latest version of plotly.js (2.17.0).

@mofojed mofojed transferred this issue from deephaven/deephaven-core Jan 24, 2023
@mofojed mofojed removed their assignment Jan 24, 2023
@vbabich vbabich removed the triage Issue requires triage label Jan 25, 2023
@vbabich vbabich added this to the Backlog milestone Jan 25, 2023
@vbabich vbabich added the external Waiting on an upstream fix label Jan 25, 2023
@dsmmcken
Copy link
Contributor

https://deephaven.atlassian.net/browse/DH-14666 duplicate issue reported in enterprise

@mofojed
Copy link
Member

mofojed commented Jun 2, 2023

There is a workaround for Chrome on M1 Mac: plotly/plotly.js#5970 (comment)

@mofojed
Copy link
Member

mofojed commented Jan 22, 2024

This looks like it is fixed in plotly.js 2.28: plotly/plotly.js#5970 (comment)

We should update to plotly 2.28

@dsmmcken
Copy link
Contributor

Re-test #1730 after 2.28 update as well, possibly related, possibly not.

@mofojed mofojed self-assigned this Feb 22, 2024
@mofojed
Copy link
Member

mofojed commented Feb 22, 2024

Seems to already be fixed in plotly.js 2.27, and is fixed in v0.33.0:
Engine Version: 0.33.0-SNAPSHOT
Web UI Version: 0.63.0
Java Version: 11.0.21
Barrage Version: 0.6.0
Browser Name: Chrome 121
OS Name: macOS 10.15.7

image

We should still update to plotly 2.29, but this issue appears to already be resolved.

@mofojed mofojed closed this as completed Feb 22, 2024
@mofojed
Copy link
Member

mofojed commented Feb 27, 2024

For posterity, the snippet converted for the latest/correct formatting:

from deephaven import time_table
from deephaven.plot.figure import Figure
from deephaven.plot import PlotStyle
from deephaven.plot import Color, Colors
from deephaven.plot import font_family_names, Font, FontStyle, Shape


data = time_table('PT0.1s') \
    .update(["Open = i + 10*random()","High = Open + 1", "Low = Open - 1", "Close = Open + 0.5"])

points = data \
    .where("i%5 = 0") \
    .view(["Timestamp", "Point = i%3==0 ? High : Low"])

# broken
plot = Figure() \
    .figure_title("OHLC + Points")\
    .plot_xy(series_name="OHLC", t=data, x="Timestamp", y_high="High", y_low="Low", y="Close") \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .point(shape=Shape.DIAMOND, size=8, label="Big Triangle",color=Colors.BLUE )\
    .show()

# broken
plot = Figure() \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .point(shape=Shape.DIAMOND, size=8, label="Big Triangle",color=Colors.BLUE )\
    .show()  
 
# broken
plot = Figure() \
    .axes(plot_style=PlotStyle.SCATTER)\
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .show()  

# drawing the line plot works
plot = Figure() \
    .plot_xy(series_name="Points", t=points, x="Timestamp", y="Point")\
    .show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Waiting on an upstream fix
Projects
None yet
Development

No branches or pull requests

4 participants