You can try this
this plot/API available over the internet
plumbr.R
#' @get /plotly
#' @serializer htmlwidget
plotlygraph <- function(){
library(plumber)
library(plotly)
Animals <- c("giraffes", "orangutans", "monkeys")
SF_Zoo <- c(20, 14, 23)
LA_Zoo <- c(12, 18, 29)
data <- data.frame(Animals, SF_Zoo, LA_Zoo)
p <- plot_ly(data, x = ~Animals, y = ~SF_Zoo, type = 'bar', name = 'SF Zoo') %>%
add_trace(y = ~LA_Zoo, name = 'LA Zoo') %>%
layout(yaxis = list(title = 'Count'), barmode = 'group')
return(p)
}
Run this above code using the following command on R Console
r <- plumber::plumb("plumbr.R")
r$run(host="0.0.0.0", port=8000)
After running this
The Swagger window will open
There is button "Get/Plotly" click on this then click on "try out" click on "Execute"
wait for few seconds
Step 1:
https://i.stack.imgur.com/mEcg4.png
Step 2:
https://i.stack.imgur.com/EapIw.png
Step 3:
https://i.stack.imgur.com/h74C6.png
Step 4:
[https://i.stack.imgur.com/9CkGc.png][4]
then it shows HTML code
above this, it gives a Request URL like this
http://127.0.0.1:8000/plotly
copy that link paste in the browser you will see the plot
Then using terminal/command prompt get your IP...
Assume your IP is "192.168.10.04"
copy it and replace it with this like:-
http://192.168.10.04:8000/plotly
Then copy that link and paste it to your IFRAME of another web app
You will see your R Plot on a new framework (web app)...
I think this should help you