Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

json converstion and numpy array #5340

Open
Labels
P1needed for current cycle bugsomething broken regressionthis used to work
@AugustinErnoult

Description

I recently updated NumPy to version 2.2.5 and Plotly to version 6.3.0.
Since then, the JSON conversion has not been dealing with the NumPy array anymore. The x and y data are strange objects with no numerical values. The HTML conversion do not show this issue.

Here is some minimal code that generates the issue:

import numpy as np
import plotly.graph_objects as go
x = [1,5,4]
y = [0,0,2]
fig_array = go.Figure()
fig_array.add_trace(go.Scatter(x=np.array(x),
 y=np.array(y),
 ))
fig_array.write_json('test_array.json', pretty=True)
fig_array.write_html('test.html')
fig_list = go.Figure()
fig_list.add_trace(go.Scatter(x=x,
 y=y,
 ))
fig_list.write_json('test_list.json', pretty=True)

Here the obtained data fields in the json files.

'test_list.json':

"data": [{"x": [1,5,4], "y": [0,0,2], "type": "scatter" }]

'test_array.json':

"data": [{ "x": {"dtype": "i1", "bdata": "AQUE"}, "y": { "dtype": "i1", "bdata": "AAAC"}, "type": "scatter" }]

The html file is ok!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1needed for current cycle bugsomething broken regressionthis used to work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /