Skip to content

Plotly.Py cannot load JSON created in ggplotly in Plotly.R  #3337

@rl-utility-man

Description

@rl-utility-man

Hello,

I want to give my R-coding colleagues access to a custom Plotly.py layout script by saving JSON in R and then loading it into Python. However, when I try this I plotly.io.read_json reports that the JSON produced in Plotly.R contains invalid tags and an invalid "transparent" color. If I make knock out two keys with Null values and replace the "transparent" color with white, then the JSON loads.

The attached R_to_JSON_to_Python.zip show a simple test case where I create a graph from the ggPlotly documentation, save it to JSON, fail to load in Plotly.IO, then make three changes to the JSON and can load it.

I can replicate this on the latest R (x86-64 4.1.0, 5/18/21) and the latest Plotly on CRAN; and using Plotly 5.1.0 and Python 3.8.10 on Windows.

Is an appropriate way to bridge R and Python Plotly to save JSON in R and load it in Python?

Is the existing work around shown here going to be robust to adding more complexity to the graphs without endangering data?

Thanks!

-Rob

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions