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

Use plotly.js base64 API to store and pass typed arrays declared by numpy, pandas, etc. #4470

Open
wants to merge 107 commits into
base: master
Choose a base branch
from

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 21, 2023

This PR make use of this plotly.js PR and changes the default behavior to pass numpy arrays as plotly.js base64 spec.

Code Changes

  • Adds to_typed_array_spec function to use for converting numpy arrays to the "typed array spec" type that plotly.js expects when receiving base64 encoded arrays.
  • Updates the validate_coerce function of the DataArrayValidator class to base64 encode numpy arrays and store them in the "typed array spec" format (by calling to_typed_array_spec)
  • Adds thorough testing to validators
  • Adds performance (size and speed) tests

version: 3.9.0
plotly:
description: How to format axes of 3d plots in Python with Plotly.
display_as: b64
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
display_as: b64
display_as: advanced_opt

I think we could put this in the Advanced section

doc/python/b64.md Outdated Show resolved Hide resolved
doc/python/b64.md Outdated Show resolved Hide resolved
permalink: python/b64/
thumbnail: thumbnail/b64.png
---

Copy link
Member

Choose a reason for hiding this comment

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

Could you add some context on the benefits of doing this. What does it bring for the user?

archmoj and others added 3 commits February 29, 2024 11:10
 - fixed Conflicts in
 packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py
 packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py
@gvwilson gvwilson assigned marthacryan and unassigned emilykl Aug 13, 2024
@gvwilson gvwilson added feature something new P1 needs immediate attention labels Aug 13, 2024
@marthacryan marthacryan reopened this Aug 30, 2024
@marthacryan
Copy link
Contributor

(Closed and reopened to kick CI)

@marthacryan marthacryan self-requested a review September 9, 2024 09:47
We decided that the documentation on base64 wouldn't be as clear because most people wouldn't understand what we mean by base64. Instead, we're going to make documentation on usage of numpy arrays.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P1 needs immediate attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants