I am using threejs library in R.
library(threejs)
z <- seq(-10, 10, 0.01)
x <- cos(z)
y <- sin(z)
scatterplot3js(x,y,z, color=rainbow(length(z)))
I need to save the interactive plot created by above commands as a.html file in a specified folder without using the drop down (in Rstudio) under viwer -> export which "save as web page".
Is there any R code for this?
Any figure can be saved as an HTML file using the write_html method. These HTML files can be opened in any web browser to access the fully interactive figure.
Plots panel –> Export –> Save as Image or Save as PDF It's also possible to save the graph using R codes as follow: Specify files to save your image using a function such as jpeg(), png(), svg() or pdf(). Additional argument indicating the width and the height of the image can be also used. Create the plot.
To share a plot from the Chart Studio Workspace, click 'Share' button on the left-hand side after saving the plot. The Share modal will pop-up and display a link under the 'Embed' tab. You can then copy and paste this link to your website. You have the option of embedding your plot as an HTML snippet or iframe.
Using htmlwidgets
package you can do...
library(htmlwidgets)
dir.create("Z:\\new folder")
saveWidget(scatterplot3js(x,y,z, color=rainbow(length(z))),
file="Z:\\new folder\\scatterplot.html")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With