diff --git a/pkgdown.yml b/pkgdown.yml index 2ca0c43..9899c46 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: fonts: fonts.html scaling: scaling.html -last_built: 2023-10-11T07:30Z +last_built: 2023-10-11T08:09Z urls: reference: https://svglite.r-lib.org/reference article: https://svglite.r-lib.org/articles diff --git a/reference/svgstring.html b/reference/svgstring.html index 07fee8a..4c1e0ba 100644 --- a/reference/svgstring.html +++ b/reference/svgstring.html @@ -272,35 +272,33 @@

Examples#> </clipPath> #> </defs> #> <g clip-path='url(#cpNTkuMDR8Njg5Ljc2fDU5LjA0fDUwMi41Ng==)'> -#> <circle cx='82.40' cy='233.70' r='2.70' style='stroke-width: 0.75;' /> -#> <circle cx='183.32' cy='486.13' r='2.70' style='stroke-width: 0.75;' /> -#> <circle cx='381.21' cy='120.18' r='2.70' style='stroke-width: 0.75;' /> -#> <circle cx='185.63' cy='75.47' r='2.70' style='stroke-width: 0.75;' /> -#> <circle cx='666.40' cy='283.87' r='2.70' style='stroke-width: 0.75;' /> +#> <circle cx='239.83' cy='239.02' r='2.70' style='stroke-width: 0.75;' /> +#> <circle cx='666.40' cy='361.18' r='2.70' style='stroke-width: 0.75;' /> +#> <circle cx='644.00' cy='448.20' r='2.70' style='stroke-width: 0.75;' /> +#> <circle cx='82.40' cy='75.47' r='2.70' style='stroke-width: 0.75;' /> +#> <circle cx='433.82' cy='486.13' r='2.70' style='stroke-width: 0.75;' /> #> </g> #> <g clip-path='url(#cpMC4wMHw3MjAuMDB8MC4wMHw1NzYuMDA=)'> -#> <line x1='136.43' y1='502.56' x2='633.21' y2='502.56' style='stroke-width: 0.75;' /> -#> <line x1='136.43' y1='502.56' x2='136.43' y2='509.76' style='stroke-width: 0.75;' /> -#> <line x1='260.62' y1='502.56' x2='260.62' y2='509.76' style='stroke-width: 0.75;' /> -#> <line x1='384.82' y1='502.56' x2='384.82' y2='509.76' style='stroke-width: 0.75;' /> -#> <line x1='509.01' y1='502.56' x2='509.01' y2='509.76' style='stroke-width: 0.75;' /> -#> <line x1='633.21' y1='502.56' x2='633.21' y2='509.76' style='stroke-width: 0.75;' /> -#> <text x='136.43' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-1.5</text> -#> <text x='260.62' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-1.0</text> -#> <text x='384.82' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-0.5</text> -#> <text x='509.01' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.0</text> -#> <text x='633.21' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.5</text> -#> <line x1='59.04' y1='493.97' x2='59.04' y2='115.35' style='stroke-width: 0.75;' /> -#> <line x1='59.04' y1='493.97' x2='51.84' y2='493.97' style='stroke-width: 0.75;' /> -#> <line x1='59.04' y1='399.31' x2='51.84' y2='399.31' style='stroke-width: 0.75;' /> -#> <line x1='59.04' y1='304.66' x2='51.84' y2='304.66' style='stroke-width: 0.75;' /> -#> <line x1='59.04' y1='210.00' x2='51.84' y2='210.00' style='stroke-width: 0.75;' /> -#> <line x1='59.04' y1='115.35' x2='51.84' y2='115.35' style='stroke-width: 0.75;' /> -#> <text transform='translate(41.76,493.97) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-0.5</text> -#> <text transform='translate(41.76,399.31) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.0</text> -#> <text transform='translate(41.76,304.66) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.5</text> -#> <text transform='translate(41.76,210.00) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>1.0</text> -#> <text transform='translate(41.76,115.35) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>1.5</text> +#> <line x1='179.09' y1='502.56' x2='595.67' y2='502.56' style='stroke-width: 0.75;' /> +#> <line x1='179.09' y1='502.56' x2='179.09' y2='509.76' style='stroke-width: 0.75;' /> +#> <line x1='317.95' y1='502.56' x2='317.95' y2='509.76' style='stroke-width: 0.75;' /> +#> <line x1='456.81' y1='502.56' x2='456.81' y2='509.76' style='stroke-width: 0.75;' /> +#> <line x1='595.67' y1='502.56' x2='595.67' y2='509.76' style='stroke-width: 0.75;' /> +#> <text x='179.09' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-1.5</text> +#> <text x='317.95' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-1.0</text> +#> <text x='456.81' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-0.5</text> +#> <text x='595.67' y='528.48' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.0</text> +#> <line x1='59.04' y1='488.92' x2='59.04' y2='129.78' style='stroke-width: 0.75;' /> +#> <line x1='59.04' y1='488.92' x2='51.84' y2='488.92' style='stroke-width: 0.75;' /> +#> <line x1='59.04' y1='399.14' x2='51.84' y2='399.14' style='stroke-width: 0.75;' /> +#> <line x1='59.04' y1='309.35' x2='51.84' y2='309.35' style='stroke-width: 0.75;' /> +#> <line x1='59.04' y1='219.56' x2='51.84' y2='219.56' style='stroke-width: 0.75;' /> +#> <line x1='59.04' y1='129.78' x2='51.84' y2='129.78' style='stroke-width: 0.75;' /> +#> <text transform='translate(41.76,488.92) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='23.43px' lengthAdjust='spacingAndGlyphs'>-0.5</text> +#> <text transform='translate(41.76,399.14) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.0</text> +#> <text transform='translate(41.76,309.35) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>0.5</text> +#> <text transform='translate(41.76,219.56) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>1.0</text> +#> <text transform='translate(41.76,129.78) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='19.09px' lengthAdjust='spacingAndGlyphs'>1.5</text> #> <polygon points='59.04,502.56 689.76,502.56 689.76,59.04 59.04,59.04 ' style='stroke-width: 0.75;' /> #> <text x='374.40' y='557.28' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='53.09px' lengthAdjust='spacingAndGlyphs'>rnorm(5)</text> #> <text transform='translate(12.96,280.80) rotate(-90)' text-anchor='middle' style='font-size: 12.00px; font-family: "Liberation Sans";' textLength='53.09px' lengthAdjust='spacingAndGlyphs'>rnorm(5)</text> diff --git a/search.json b/search.json index 0acfd92..4be09df 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement codeofconduct@posit.co. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://svglite.r-lib.org/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://svglite.r-lib.org/articles/fonts.html","id":"system-font-aliases","dir":"Articles","previous_headings":"","what":"System font aliases","title":"Specifying fonts","text":"system_fonts takes named list font families argument. names typically correspond standard R faces can also alias non-standard families (though less useful): need support non-latin characters, choose fonts good Unicode coverage. “Arial Unicode MS” sans serif font good coverage available macOS Windows systems (latter, MS Office installed). Note font support kerning bold italic faces. Noto fontset provided Google well Han Sans family Adobe excellent coverage may available time rendering. can concern distribute SVG files Internet.","code":"fonts <- list( sans = \"Helvetica\", mono = \"Consolas\", `Times New Roman` = \"DejaVu Serif\" ) ss <- svgstring(system_fonts = fonts) plot(1:10) text(0.8, 0.8, \"Some text\", family = \"mono\") text(0.2, 0.2, \"Other text\", family = \"Times New Roman\") dev.off() ss() svglite(\"Rplots.svg\", system_fonts = list(sans = \"Arial Unicode MS\")) plot.new() text(0.5, 0.5, \"正規分布\") dev.off()"},{"path":"https://svglite.r-lib.org/articles/fonts.html","id":"user-font-aliases","dir":"Articles","previous_headings":"","what":"User font aliases","title":"Specifying fonts","text":"addition system fonts, can also provide fonts necessarily installed system (.e., fonts live user space). main reason generate reproducible SVG files different platforms can different versions font thus produce different text metrics. user_fonts arguments takes either paths font files, fonts fontquiver package, list specifies alias. Whereas system_fonts gets named list families argument, user_fonts takes named tree lists families (sans, serif, mono symbol) faces (plain, italic, bold, bolditalic, symbol): can also control font gets written font-family fields SVGs supplying list containing alias file elements: fontquiver fonts particularly useful creating reproducible SVG files. vdiffr package uses svglite fontquiver fonts create visual unit tests reliably across platforms. Liberation fontset appropriate usage features 12 combinations standard R families faces. addition fontquiver provides Symbola symbol font. function fontquiver::font_families() produces list appropriate structure can directly supplied svglite:","code":"# Using ttf files from fontquiver here, but it could be any ttf some_file <- fontquiver::font(\"Liberation\", \"Sans\", \"Regular\")$ttf other_file <- fontquiver::font(\"Liberation\", \"Sans\", \"Italic\")$ttf serif_file <- fontquiver::font(\"Liberation\", \"serif\", \"Italic\")$ttf # The outer named list contains families while the inner named list # contains faces: fonts <- list( sans = list( plain = some_file, italic = other_file ), serif = list(plain = serif_file) ) ss <- svglite(\"plot.svg\", user_fonts = fonts) plot.new() text(0.5, 0.5, \"Sans Plain text\") text(0.2, 0.2, \"Sans Italic text\", font = 3) text(0.8, 0.8, \"Serif text\", family = \"serif\") dev.off() file_with_alias <- list(alias = \"Foobar Font\", file = other_file) fonts <- list(sans = list(plain = file_with_alias)) ss <- svgstring(user_fonts = fonts) plot(1:10) text(0.5, 0.5, \"Sans text\") dev.off() ss() fonts <- fontquiver::font_families(\"Liberation\") fonts$symbol$symbol <- fontquiver::font_symbol(\"Symbola\") str(fonts, 2) svglite(\"reproducible.svg\", user_fonts = fonts) plot(1:10) dev.off()"},{"path":"https://svglite.r-lib.org/articles/fonts.html","id":"debugging-font-matching","dir":"Articles","previous_headings":"","what":"Debugging font matching","title":"Specifying fonts","text":"systemfonts package used match font family names fonts installed system. systemfonts always return valid font, requested font badly misspelled missing, default returned. test expected font matched can use match_font() font_info() functions systemfonts:","code":"systemfonts::match_font(\"Helvetica\") #> $path #> [1] \"/usr/share/fonts/opentype/urw-base35/NimbusSans-Regular.otf\" #> #> $index #> [1] 0 #> #> $features #> NULL systemfonts::font_info(\"Helvetica\", bold = TRUE) #> path index #> 1 /usr/share/fonts/opentype/urw-base35/NimbusSans-Bold.otf 0 #> family style italic bold monospace weight width kerning color #> 1 Nimbus Sans Bold FALSE TRUE FALSE bold normal FALSE FALSE #> scalable vertical n_glyphs n_sizes n_charmaps #> 1 TRUE FALSE 855 0 4 #> bbox max_ascend max_descend #> 1 -2.25000, 12.82812, -3.68750, 12.84375 8.75 -3.25 #> max_advance_width max_advance_height lineheight underline_pos #> 1 13.48438 14.40625 14.40625 -1.859375 #> underline_size #> 1 0.828125"},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"scaling-svg-outputs","dir":"Articles","previous_headings":"","what":"Scaling SVG outputs","title":"Scaling Issues","text":"SVG files produced svglite include width height properties. deliberate choice intended make easier fit fluidly SVG figure enclosing container. scaling straightforward requires understanding viewBox SVG attribute included SVGs produced svglite. property defines aspect ratio plot (well user coordinate system, see next section).","code":""},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"fluid-scaling","dir":"Articles","previous_headings":"Scaling SVG outputs","what":"Fluid scaling","title":"Scaling Issues","text":"viewBox determined width height arguments svglite’s device functions (10’’ x 8’’ default). Although dimensions supplied inches, viewBox’s user coordinate system completely unit agnostic. main effect thus determine aspect ratio. Since dimensions provided, dimensions enclosing container used instead SVG rescaled fit container (although Internet Explorer currently requires CSS tricks get behaviour, see https://tympanus.net/codrops/2014/08/19/making-svgs-responsive--css/). Aspect ratio preserved default figure scaled . details aspect ratio preserved can adjusted multiple ways via preserveAspectRatio attribute. See https://www.sarasoueidan.com/blog/svg-coordinate-systems/ information property. useful resource: https://css-tricks.com/scale-svg/","code":""},{"path":"https://svglite.r-lib.org/articles/scaling.html","id":"natural-scaling","dir":"Articles","previous_headings":"Scaling SVG outputs","what":"Natural scaling","title":"Scaling Issues","text":"Another strategy needed order scale figure make text within SVG consistent text surrounding web page. useful, instance, create consistent appearance HTML presentation. Since user coordinate system defined viewBox unitless, need map figure natural dimensions. ensure correspondence scale figure web page. mentioned , natural scale svglite’s figures points determined width height arguments supply device functions (10’’ x 8’’ default). Although dimensions specified inches, coordinate system scaled points. Counting 72 points per inch, default SVG surface thus 720 x 576 pt. Note CSS standard defines 12pt equal 16px, default size text browsers. Since 12pt default text size svglite well, SVG scaled natural dimensions appear seamless web text 16px. text web page another size, compute scale factor adjust dimensions SVG accordingly. sum , displaying plot according natural dimensions requires providing user agent information lengths defined within SVG actually mean. several ways achieve . First can edit SVG enclose another pair tags defines height width. root element determines final dimensions figure. second way enclose figure
tag appropriate dimensions let SVG figure rescale container (cf. section fluid scaling): Finally, can directly specify dimensions tag embedding figure. Note dimension attributes tags accept arbitrary units, supply dimensions pixels. Just multiply width height measured points factor 16/12:","code":"
<\/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 #> #> #> #>