<\/div>
"},{"path":[]},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"device-scaling","dir":"Articles","previous_headings":"Internal notes","what":"Device scaling","title":"Scaling Issues","text":"graphics devices, svglite scaled big points (1/72 inch) rather pica points (1/72.27 inch). Note LaTeX grid graphics system ggplot2 based, points refer pica points. Big points denoted LaTeX bp CSS pt. use latter notation. See https://tex.stackexchange.com//200968/19755 historical background units. conversion device units physical dimensions determined DevDesc parameter ipr. IPR stands inches per raster (native device coordinates sometimes called rasters R terminology) set 1/72 svglite. device’s physical dimensions set following DevDesc parameters (width height plot dimensions set user inches): default svglite plot surface thus 720 x 576 pt.","code":""},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"scaling-of-graphical-elements","dir":"Articles","previous_headings":"Internal notes","what":"Scaling of graphical elements","title":"Scaling Issues","text":"conventional fundamental line width (lwd = 1) correspond line width 1/96 inch svglite obeys convention. Also, like R graphics devices, svglite interprets point sizes directly big points (e.g. ps graphical parameter fontsize argument device functions). default font size 12pt. Text metrics computed systemfonts, uses freetype extract metrics glyph calculate string dimensions . Text metrics calculated 1000dpi based cex * ps font size. Base graphics system also makes use obscure cra parameter relatives (cin, cxy, csi). cra serves crude measure default character height width default fontsize provided device called (12pt svgilte). main effect parameter (specifically, height component) change relationship margin parameters mar/mai oma/omi. margins mar oma specified line units character height used measure line spacing convert margins measured lines physical margins. devices, cra[0] set 0.9 * pointsize cra[1] 1.2 * pointsize. parameters completely unused Grid graphics system.","code":""},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"svg-output","dir":"Articles","previous_headings":"Internal notes","what":"SVG output","title":"Scaling Issues","text":"SVG output sets viewBox (user coordinate system) values scaled big points. viewBox: width height set dd->right dd->bottom respectively (values determined user-supplied figure width height). Line width: 1 lwd equal 1/96 inch. svglite gets values scaled device coordinates (big points), line width multiplied 72/96. Text: gdtools returns metrics scaled big points transformation needed. need add px units work around rendering bug Firefox. Note viewBox set , pixel equals one unit user coordinate system thus actually represents big point.","code":""},{"path":"https://svglite.r-lib.org/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Hadley Wickham. Author. Lionel Henry. Author. Thomas Lin Pedersen. Maintainer, author. T Jake Luciani. Author. Matthieu Decorde. Author. Vaudor Lise. Author. Tony Plate. Contributor. Early line dashing code David Gohel. Contributor. Line dashing code early raster code Yixuan Qiu. Contributor. Improved styles; polypath implementation Håkon Malmedal. Contributor. Opacity code . Copyright holder, funder.","code":""},{"path":"https://svglite.r-lib.org/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Wickham H, Henry L, Pedersen T, Luciani T, Decorde M, Lise V (2023). svglite: 'SVG' Graphics Device. https://svglite.r-lib.org, https://github.com/r-lib/svglite.","code":"@Manual{, title = {svglite: An 'SVG' Graphics Device}, author = {Hadley Wickham and Lionel Henry and Thomas Lin Pedersen and T Jake Luciani and Matthieu Decorde and Vaudor Lise}, year = {2023}, note = {https://svglite.r-lib.org, https://github.com/r-lib/svglite}, }"},{"path":"https://svglite.r-lib.org/index.html","id":"svglite-","dir":"","previous_headings":"","what":"An SVG Graphics Device","title":"An SVG Graphics Device","text":"svglite graphics device produces clean svg output, suitable use web, hand editing. Compared built-svg(), svglite produces smaller files, leaves text , making easier edit result creation. also supports multiple nice features embedding web fonts.","code":""},{"path":"https://svglite.r-lib.org/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"An SVG Graphics Device","text":"svglite available CRAN using install.packages(\"svglite\"). can install development version github :","code":"# install.packages(\"pak\") pak::pak(\"r-lib/svglite\")"},{"path":"https://svglite.r-lib.org/index.html","id":"motivation","dir":"","previous_headings":"","what":"Motivation","title":"An SVG Graphics Device","text":"grDevices package bundled R already comes SVG device (using eponymous svg() call). development svglite motivated following considerations:","code":""},{"path":"https://svglite.r-lib.org/index.html","id":"speed","dir":"","previous_headings":"Motivation","what":"Speed","title":"An SVG Graphics Device","text":"svglite() considerably faster svg(). rendering SVGs dynamically serve web can quite important:","code":"library(svglite) x <- runif(1e3) y <- runif(1e3) tmp1 <- tempfile() tmp2 <- tempfile() svglite_test <- function() { svglite(tmp1) plot(x, y) dev.off() } svg_test <- function() { svg(tmp2, onefile = TRUE) plot(x, y) dev.off() } bench::mark(svglite_test(), svg_test(), min_iterations = 250, check = FALSE) #> # A tibble: 2 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #>
#> 1 svglite_test() 2.08ms 2.23ms 438. 691KB 7.13 #> 2 svg_test() 6.07ms 6.26ms 159. 179KB 0.638"},{"path":"https://svglite.r-lib.org/index.html","id":"file-size","dir":"","previous_headings":"Motivation","what":"File size","title":"An SVG Graphics Device","text":"Another point high relevance serving SVGs web size. svglite() produces much smaller files cases, compressing make .svgz (gzipped svg) worthwhile. svglite supports compressed output directly triggered provided path \".svgz\" (\".svg.gz\") extension.","code":"# svglite fs::file_size(tmp1) #> 75K # svg fs::file_size(tmp2) #> 321K tmp3 <- tempfile(fileext = \".svgz\") svglite(tmp3) plot(x, y) invisible(dev.off()) # svglite - svgz fs::file_size(tmp3) #> 9.42K"},{"path":"https://svglite.r-lib.org/index.html","id":"editability","dir":"","previous_headings":"Motivation","what":"Editability","title":"An SVG Graphics Device","text":"One main reasons size difference size output svglite() svg() fact svglite() encodes text styled elements, whereas svg() converts glyphs polygons renders . latter approach means output svg() require font present system displays SVG makes less impossible edit text fact. svglite focuses providing maximal editability output, can open result vector drawing program Inkscape Illustrator polish output choose.","code":""},{"path":"https://svglite.r-lib.org/index.html","id":"font-support","dir":"","previous_headings":"Motivation","what":"Font support","title":"An SVG Graphics Device","text":"svglite uses systemfonts font discovery means installed fonts system available use. systemfonts foundation means fonts registered register_font() register_variant() also available. contains non-standard weights OpenType features (e.g. ligatures tabular numerics) correctly encoded style block. systemfonts also allows embed webfont @imports file ensure file looks expected even systems without used font installed.","code":""},{"path":"https://svglite.r-lib.org/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"An SVG Graphics Device","text":"Please note svglite project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://svglite.r-lib.org/reference/create_svgz.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert an svg file to svgz, overwriting the old file — create_svgz","title":"Convert an svg file to svgz, overwriting the old file — create_svgz","text":"Convert svg file svgz, overwriting old file","code":""},{"path":"https://svglite.r-lib.org/reference/create_svgz.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert an svg file to svgz, overwriting the old file — create_svgz","text":"","code":"create_svgz(file)"},{"path":"https://svglite.r-lib.org/reference/create_svgz.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert an svg file to svgz, overwriting the old file — create_svgz","text":"file path file convert","code":""},{"path":"https://svglite.r-lib.org/reference/editSVG.html","id":null,"dir":"Reference","previous_headings":"","what":"Run plotting code and open svg in OS/system default svg viewer or editor. — editSVG","title":"Run plotting code and open svg in OS/system default svg viewer or editor. — editSVG","text":"useful primarily testing post-processing SVG.","code":""},{"path":"https://svglite.r-lib.org/reference/editSVG.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run plotting code and open svg in OS/system default svg viewer or editor. — editSVG","text":"","code":"editSVG(code, ..., width = NA, height = NA)"},{"path":"https://svglite.r-lib.org/reference/editSVG.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run plotting code and open svg in OS/system default svg viewer or editor. — editSVG","text":"code Plotting code execute. ... arguments passed svglite. height, width Height width inches.","code":""},{"path":"https://svglite.r-lib.org/reference/editSVG.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run plotting code and open svg in OS/system default svg viewer or editor. — editSVG","text":"","code":"if (interactive()) { editSVG(plot(1:10)) editSVG(contour(volcano)) }"},{"path":"https://svglite.r-lib.org/reference/font_face.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a font-face specification — font_face","title":"Create a font-face specification — font_face","text":"Webfonts SVG HTML can either specified manually using @font-face -rule, imported e.g. Google Fonts using @import -rule. font_face() helps create valid @font-face block web_fonts argument svglite() svgstring() functions.","code":""},{"path":"https://svglite.r-lib.org/reference/font_face.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a font-face specification — font_face","text":"","code":"font_face( family, woff2 = NULL, woff = NULL, ttf = NULL, otf = NULL, eot = NULL, svg = NULL, local = NULL, weight = NULL, style = NULL, range = NULL, variant = NULL, stretch = NULL, feature_setting = NULL, variation_setting = NULL )"},{"path":"https://svglite.r-lib.org/reference/font_face.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a font-face specification — font_face","text":"family font family name font respond . woff2, woff, ttf, otf, eot, svg URLs font different formats. least one must given. Best browser support provided woff format. local One font names local installations font may . local font found either given names used download happen. weight optional value font-weight descriptor style optional value font-style descriptor range optional value unicode-range descriptor give range unicode values font support variant optional value font-variant descriptor stretch optional value font-stretch descriptor feature_setting optional value font-feature-settings descriptor recommended avoid using possible variation_setting optional value font-variation-settings descriptor.","code":""},{"path":"https://svglite.r-lib.org/reference/font_face.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a font-face specification — font_face","text":"character string @font-face block.","code":""},{"path":"https://svglite.r-lib.org/reference/font_face.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a font-face specification — font_face","text":"","code":"font_face( family = \"MyHelvetica\", ttf = \"MgOpenModernaBold.ttf\", local = c(\"Helvetica Neue Bold\", \"HelveticaNeue-Bold\"), weight = \"bold\" ) #> @font-face { #> font-family: \"MyHelvetica\"; #> src: local(\"Helvetica Neue Bold\"), #> local(\"HelveticaNeue-Bold\"), #> url(\"MgOpenModernaBold.ttf\") format(\"truetype\"); #> font-weight: bold; #> }"},{"path":"https://svglite.r-lib.org/reference/htmlSVG.html","id":null,"dir":"Reference","previous_headings":"","what":"Run plotting code and view svg in RStudio Viewer or web browser. — htmlSVG","title":"Run plotting code and view svg in RStudio Viewer or web browser. — htmlSVG","text":"useful primarily testing. Requires htmltools package.","code":""},{"path":"https://svglite.r-lib.org/reference/htmlSVG.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run plotting code and view svg in RStudio Viewer or web browser. — htmlSVG","text":"","code":"htmlSVG(code, ...)"},{"path":"https://svglite.r-lib.org/reference/htmlSVG.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run plotting code and view svg in RStudio Viewer or web browser. — htmlSVG","text":"code Plotting code execute. ... arguments passed svglite.","code":""},{"path":"https://svglite.r-lib.org/reference/htmlSVG.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run plotting code and view svg in RStudio Viewer or web browser. — htmlSVG","text":"","code":"if (interactive() && require(\"htmltools\")) { htmlSVG(plot(1:10)) htmlSVG(hist(rnorm(100))) }"},{"path":"https://svglite.r-lib.org/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. systemfonts font_feature, register_font, register_variant","code":""},{"path":"https://svglite.r-lib.org/reference/stringSVG.html","id":null,"dir":"Reference","previous_headings":"","what":"Run plotting code and return svg as string — stringSVG","title":"Run plotting code and return svg as string — stringSVG","text":"useful primarily testing can used alternative svgstring().","code":""},{"path":"https://svglite.r-lib.org/reference/stringSVG.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run plotting code and return svg as string — stringSVG","text":"","code":"stringSVG(code, ...)"},{"path":"https://svglite.r-lib.org/reference/stringSVG.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run plotting code and return svg as string — stringSVG","text":"code Plotting code execute. ... arguments passed svglite.","code":""},{"path":"https://svglite.r-lib.org/reference/stringSVG.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run plotting code and return svg as string — stringSVG","text":"","code":"stringSVG(plot(1:10)) #> Saving 6.67\" x 6.67\" image #> #>