How to embed a plotly graph on a wordpress website? How to embed a plotly graph on a wordpress website? wordpress wordpress

How to embed a plotly graph on a wordpress website?


I can't help you with solution 1, but re: solution 2, while this is maddening to find, there is actually a pretty simple solution.

First, you need to register with chart studio online and generate your api key. For whatever reason, to generate your api key you to view your "settings." (see here: https://chart-studio.plotly.com/settings/api)

Once you've got your api key, you can the following code from R and it will upload your plotly chart to your profile.

#first we register to upload to plotlykey <- readLines("path/to/your/api/key")Sys.setenv("plotly_username"="<your username>")Sys.setenv("plotly_api_key"=key)#now we post to ploltyplotly_POST(  x = last_plot(),  file = "<whatever you want to name your plot>",  fileopt = "overwrite",  sharing = c("public"),  world_readable=TRUE)#note that evidently, plotly_POST is depreciated, though it worked for me as of 11/2020#use instead the call below, with the same argumentsapi_create(  x = last_plot(),  file = "<whatever you want to name your plot>",  fileopt = "overwrite",  sharing = c("public"),  world_readable=TRUE)