Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.1%) to scientific vocabulary
Keywords
r
svg
Keywords from Contributors
package-creation
setup
tidy-data
visualisation
shiny
excel
devtools
r-packages
c-plus-plus-20
rcpp
Last synced: 10 months ago
·
JSON representation
Repository
A lightweight svg graphics device for R
Basic Info
- Host: GitHub
- Owner: r-lib
- Language: C++
- Default Branch: main
- Homepage: https://svglite.r-lib.org
- Size: 6.98 MB
Statistics
- Stars: 195
- Watchers: 9
- Forks: 39
- Open Issues: 5
- Releases: 13
Topics
r
svg
Created over 13 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
Code of conduct
README.Rmd
---
output: github_document
---
```{r}
#| include: false
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# svglite
[](https://github.com/r-lib/svglite/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=svglite)
[](https://app.codecov.io/gh/r-lib/svglite)
svglite is a graphics device that produces clean svg output, suitable for use on the web, or hand editing. Compared to the built-in `svg()`, svglite produces smaller files, and leaves text as is, making it easier to edit the result after creation. It also supports multiple nice features such as embedding of web fonts.
## Installation
svglite is available on CRAN using `install.packages("svglite")`. You can install the development version from github with:
```{r}
#| eval: false
# install.packages("pak")
pak::pak("r-lib/svglite")
```
## Motivation
The grDevices package bundled with R already comes with an SVG device (using the eponymous `svg()` call). The development of svglite is motivated by the following considerations:
### Speed
`svglite()` is considerably faster than `svg()`. If you are rendering SVGs dynamically to serve over the web this can be quite important:
```{r}
#| message: false
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)
```
### File size
Another point with high relevance when serving SVGs over the web is the size. `svglite()` produces much smaller files
```{r}
# svglite
fs::file_size(tmp1)
# svg
fs::file_size(tmp2)
```
In both cases, compressing to make `.svgz` (gzipped svg) is worthwhile. svglite supports compressed output directly which will be triggered if the provided path has a `".svgz"` (or `".svg.gz"`) extension.
```{r}
tmp3 <- tempfile(fileext = ".svgz")
svglite(tmp3)
plot(x, y)
invisible(dev.off())
# svglite - svgz
fs::file_size(tmp3)
```
### Editability
One of the main reasons for the size difference between the size of the output of `svglite()` and `svg()` is the fact that `svglite()` encodes text as styled `` elements, whereas `svg()` converts the glyphs to polygons and renders these. The latter approach means that the output of `svg()` does not require the font to be present on the system that displays the SVG but makes it more or less impossible to edit the text after the fact. svglite focuses on providing maximal editability of the output, so that you can open up the result in a vector drawing program such as Inkscape or Illustrator and polish the output if you so choose.
### Font support
svglite uses systemfonts for font discovery which means that all installed fonts on your system is available to use. The systemfonts foundation means that fonts registered with `register_font()` or `register_variant()` will also be available, as will fonts added with `add_fonts()` and `require_font()`. If any of these contains non-standard weights or OpenType features (e.g. ligatures or tabular numerics) this will be correctly encoded in the style block. systemfonts also allows you to embed webfont `@imports` in your file to ensure that the file looks as expected even on systems without the used font installed. Using `systemfonts::fonts_as_import()` you can generate these imports automatically, optionally embedding the font data directly in the file.
## Building svglite
_This section is only relevant for building svglite from scratch, as opposed to installing from a pre-built package on CRAN._
Building svglite requires the system dependency libpng. As svglite doesn't have any build-time configuration, your R configuration must point to libpng's `include` and `lib` folders.
For instance on macOS, install libpng with:
```sh
brew install libpng
```
And make sure your `~/.R/Makevars` knows about Homebrew's `include` and `lib` folders where libpng should now be installed. On arm64 hardware, this would be:
```mk
CPPFLAGS += -I/opt/homebrew/include
LDFLAGS += -L/opt/homebrew/lib
```
## Code of Conduct
Please note that the svglite project is released with a [Contributor Code of Conduct](https://svglite.r-lib.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner
- Name: R infrastructure
- Login: r-lib
- Kind: organization
- Repositories: 154
- Profile: https://github.com/r-lib
GitHub Events
Total
- Create event: 7
- Commit comment event: 1
- Release event: 2
- Issues event: 26
- Watch event: 14
- Delete event: 4
- Issue comment event: 30
- Push event: 46
- Pull request event: 15
- Fork event: 2
Last Year
- Create event: 7
- Commit comment event: 1
- Release event: 2
- Issues event: 26
- Watch event: 14
- Delete event: 4
- Issue comment event: 30
- Push event: 46
- Pull request event: 15
- Fork event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| hadley | h****m@g****m | 155 |
| Thomas Lin Pedersen | t****5@g****m | 122 |
| Lionel Henry | l****y@g****m | 88 |
| Yixuan Qiu | y****u@c****e | 49 |
| timelyportfolio | k****l@t****m | 13 |
| David Gohel | d****l@a****r | 10 |
| mdecorde | m****e@m****) | 4 |
| Jeroen Ooms | j****s@g****m | 4 |
| Trevor L. Davis | t****s@g****m | 4 |
| Matthieu Decorde | m****e@m****) | 3 |
| Michael Chirico | m****4@g****m | 3 |
| Don van den Bergh | d****h@h****m | 2 |
| Håkon Malmedal | h****l@g****m | 2 |
| Ilia Kats | i****s@g****t | 2 |
| Matthieu Decorde | m****e@e****r | 2 |
| Florian Rupprecht | 3****0 | 1 |
| Gábor Csárdi | c****r@g****m | 1 |
| Jake Luciani | j****s@g****m | 1 |
| Jim Hester | j****r@g****m | 1 |
| Paul Murrell | p****l@s****z | 1 |
Committer Domains (Top 20 + Academic)
stat.auckland.ac.nz: 1
ens-lyon.fr: 1
gmx.net: 1
matthieupc.(none): 1
mdecorde-optiplex-960.(none): 1
ardata.fr: 1
timelyportfolio.com: 1
cos.name: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 84
- Total pull requests: 48
- Average time to close issues: 8 months
- Average time to close pull requests: about 2 months
- Total issue authors: 53
- Total pull request authors: 16
- Average comments per issue: 2.46
- Average comments per pull request: 1.13
- Merged pull requests: 39
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 11
- Pull requests: 13
- Average time to close issues: 2 months
- Average time to close pull requests: 22 days
- Issue authors: 5
- Pull request authors: 2
- Average comments per issue: 1.09
- Average comments per pull request: 0.62
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- thomasp85 (22)
- trevorld (5)
- hadley (3)
- jeroen (3)
- ilia-kats (2)
- hrbrmstr (2)
- andrewmarx (1)
- CameronNemo (1)
- davidhodge931 (1)
- nx10 (1)
- ekernf01 (1)
- suvarzz (1)
- no-more-hacks (1)
- ca4wa (1)
- kurpav00 (1)
Pull Request Authors
- thomasp85 (17)
- trevorld (7)
- lionel- (7)
- gaborcsardi (3)
- MichaelChirico (3)
- vandenman (2)
- hadley (2)
- jeroen (2)
- ilia-kats (1)
- nx10 (1)
- hrbrmstr (1)
- jimhester (1)
- datawookie (1)
- pmur002 (1)
- michaelgrund (1)
Top Labels
Issue Labels
upkeep (2)
tidy-dev-day :nerd_face: (1)
feature (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 324,863 last-month
- Total docker downloads: 1,097,490
-
Total dependent packages: 71
(may contain duplicates) -
Total dependent repositories: 295
(may contain duplicates) - Total versions: 20
- Total maintainers: 1
cran.r-project.org: svglite
An 'SVG' Graphics Device
- Homepage: https://svglite.r-lib.org
- Documentation: http://cran.r-project.org/web/packages/svglite/svglite.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 2.2.1
published about 1 year ago
Rankings
Dependent repos count: 1.0%
Downloads: 1.1%
Dependent packages count: 1.5%
Forks count: 1.8%
Stargazers count: 2.4%
Average: 4.2%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
10 months ago
conda-forge.org: r-svglite
- Homepage: https://svglite.r-lib.org
- License: GPL-2.0-or-later
-
Latest release: 2.1.0
published over 4 years ago
Rankings
Dependent packages count: 8.0%
Dependent repos count: 8.8%
Average: 18.0%
Forks count: 27.6%
Stargazers count: 27.7%
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.0.0 depends
- systemfonts >= 1.0.0 imports
- covr * suggests
- fontquiver >= 0.2.0 suggests
- htmltools * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests
- xml2 >= 1.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite