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

px.line: don't use webgl if line_shape="spline" is given #4305

Merged
merged 5 commits into from
Nov 11, 2023
Merged

px.line: don't use webgl if line_shape="spline" is given #4305

merged 5 commits into from
Nov 11, 2023

Conversation

bwest2397
Copy link
Contributor

@bwest2397 bwest2397 commented Aug 1, 2023

The documentation for documentation for plotly.express.line seems to imply that when calling px.line, line_shape can be given as "linear" or "spline" without any other limitations. However, if one calls it with render_mode="auto" (or without providing render_mode, as "auto" is its default value) and with a large enough dataframe (over 1000 total plotted entries), line_shape="spline" causes an error. This error is caused by the webgl render mode (go.Scattergl) being used by default with large dataframes instead of the svg render mode (go.Scatter). This PR works around this issue by not defaulting to the webgl render mode is line_shape="spline" is given, as the documentation implies that this should work. It's worth noting that this will likely incur a performance penalty, but I think that anyone rendering that much data is willing to accept the hit :)

This should address #2812

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the codegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
  • For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

If line_shape="spline" is set and render_mode="auto", don't default to
webgl (go.Scattergl) as it doesn't support line_shape="spline".
@bwest2397 bwest2397 changed the title px.line: don't use webgl for spline shape px.line: don't use webgl if line_shape="spline" is given Aug 1, 2023
@alexcjohnson
Copy link
Collaborator

@bwest2397 thanks for this, looks great and apologies for letting it sit so long. Would you add a line in the changelog under unreleased/fixed? Then we'll merge!

@bwest2397
Copy link
Contributor Author

bwest2397 commented Nov 10, 2023

@bwest2397 thanks for this, looks great and apologies for letting it sit so long. Would you add a line in the changelog under unreleased/fixed? Then we'll merge!

@alexcjohnson Done. Assuming you agree with the content of the changelog message, feel free to merge when you're ready.

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

@alexcjohnson alexcjohnson merged commit a8a2533 into plotly:master Nov 11, 2023
4 checks passed
@bwest2397 bwest2397 deleted the workaround-px-express-line-not-accepting-spline-on-large-dataframes branch November 11, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants