-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marco Zocca
committed
Jan 8, 2024
1 parent
5096fc4
commit d3a2fa3
Showing
4 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import json | ||
|
||
def plotlyToRestyle(x): | ||
""" | ||
:param x: a Plotly object with a .to_json() implem, e.g. a Figure | ||
:return: data that can be passed to restyle in Plotly.js | ||
""" | ||
z = x.to_json() # .to_json() is Plotly implem | ||
def duplicate(w): | ||
w['x'] = [w['x']] # the .restyle() nested array bs | ||
w['y'] = [w['y']] | ||
return w | ||
return [duplicate(w) for w in json.loads(z)['data']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters