library(ggplot2)
simpleHist = data.frame(x=rnorm(1e2)) |>
ggplot(aes(x=x)) +
geom_histogram()
file = "histogram"
pdf(NULL) # create non-displaying graphics device for SVGThis and AddXML
svgfile = SVGThis(simpleHist, paste0(file, ".svg"),createDevice=FALSE)
xmlfile = AddXML(simpleHist, paste0(file, ".xml"))
dev.off() # destroy graphics device, now that we're done with it
BrowseSVG(file)
#Cleaing up from BrowseSVG
unlink(paste0(file, ".svg"))
unlink(paste0(file, ".xml"))
unlink(paste0(file, ".html"))
Run the code above in your browser using DataLab