.print_svg_with_chrome | R Documentation |
Create a the same size as the SVG file using chrome or chromium
.print_svg_with_chrome(
svgFile,
pdfFile = tempfile(fileext = ".pdf"),
chromeBinary = getOption("ggrrr.chrome", default = .find_chrome()),
maxWidth = NULL,
maxHeight = NULL
)
svgFile |
the input svg file |
pdfFile |
the output pdf file |
chromeBinary |
the location of chrome or chromium binary |
maxWidth |
the maximum width of the output in inches |
maxHeight |
the maximum height of the output in inches |
the pdf file path
try({
plot = ggplot2::ggplot(ggplot2::diamonds, ggplot2::aes(x=carat,y=price,color = color))+
ggplot2::geom_point()+
ggplot2::annotate("label",x=2,y=10000,label="Hello \u2014 world", family="Kings")+
ggplot2::labs(tag = "A")+
ggplot2::xlab("Carat\u2082")+
ggplot2::ylab("price\u2265")
res = plot %>% .gg_save_as(filename=tempfile(), formats=c("svg"))
tmp = .print_svg_with_chrome(res$svg)
# browseURL(tmp)
# The resulting pdf has fonts embedded.
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.