The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Rasterize only specific layers of a ggplot2 plot (for instance, large scatter plots with many points) while keeping all labels and text in vector format. This allows users to keep plots within a reasonable size limit without losing the vector properties of scale-sensitive information.
To install the stable version from CRAN, use:
install.packages('ggrastr')
To install the latest version, use:
install.packages('devtools')
::install_github('VPetukhov/ggrastr', build_vignettes = TRUE) devtools
Note that with ggrastr
version 0.2.0, any ggplot2 geom
provided by the user can be rasterized with the function
rasterise()
. Furthermore, when the aspect ratio is
distorted, points are rendered without distortion.
For more details and examples, see the vignettes: * HTML version * Markdown version
We also provide wrappers for several geoms to guarantee compatibility
with an older version of ggrastr
. However, we encourage
users to use the rasterise()
function instead.
geom_point_rast
: raster scatter plotsgeom_jitter_rast
: raster jittered scatter plotsgeom_boxplot_jitter
: boxplots that allows to jitter and
rasterize outlier pointsgeom_tile_rast
: raster heatmapgeom_beeswarm_rast
: raster bee swarm
plotsgeom_quasirandom_rast
: raster quasirandom
scatter plotIf your R session crashes when you try to render a rasterized plot, it’s probably the case that your version of Cairo was built for another version of R (see Upgrading to a new version of R). To check if you are using a proper version, run the command below and ensure that the “Built” version is the same as your R version.
<- as.data.frame(installed.packages(), stringsAsFactors = FALSE, row.names = FALSE)
pkgs $Package == 'Cairo', c("Package", "LibPath", "Version", "Built")] pkgs[pkgs
To ensure that Cairo works, try running
Cairo::Cairo(type='raster'); dev.off()
and check if it
crashes your R session.
If you find ggrastr
useful for your publication, please
cite:
Viktor Petukhov, Teun van den Brand and Evan Biederstedt (2021).
ggrastr: Raster Layers for 'ggplot2'. R package version 1.0.1.
https://CRAN.R-project.org/package=ggrastr
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.