-
Notifications
You must be signed in to change notification settings - Fork 628
A note on package internals
Similar to other graphing libraries such as vega, Plotly graphs are described entirely with JSON objects.
{
"data": [
{
"x": ["Zebras", "Lions"],
"y": [1, 5],
"type": "bar"
}
]
}
The R library has two general approaches to creating these JSON objects. One, is the ggplotly()
function which essentially extracts ggplot graph components (that can be translated to plotly) and converts them to JSON format. The other approach is another level of abstraction on top of plotly's JSON spec that allows you do declare complex visualizations in a compact way. In both approaches, the R library converts native R data structures, lists and vectors, to this JSON format and makes an authenticated HTTP API call to plotly's servers where the JSON is saved in a user's account. On page load, the JSON is served and fed through plotly's client-side javascript graphing library.
Earn upto $500 login https://evil.com