geom_quasirandom
, but creates a raster layerThis geom is similar to geom_quasirandom
, but creates a raster layer
geom_quasirandom_rast(
...,
width = NULL,
varwidth = FALSE,
bandwidth = 0.5,
nbins = NULL,
method = "quasirandom",
groupOnX = NULL,
dodge.width = 0,
raster.dpi = getOption("ggrastr.default.dpi", 300),
dev = "cairo",
scale = 1
)
Other arguments passed on to layer()
. These are
often aesthetics, used to set an aesthetic to a fixed value, like
colour = "red"
or size = 3
. They may also be parameters
to the paired geom/stat.
the maximum amount of spread (default: 0.4)
vary the width by the relative size of each group
the bandwidth adjustment to use when calculating density Smaller numbers (< 1) produce a tighter "fit". (default: 0.5)
the number of bins used when calculating density (has little effect with quasirandom/random distribution)
the method used for distributing points (quasirandom, pseudorandom, smiley or frowney)
if TRUE then jitter is added to the x axis and if FALSE jitter is added to the y axis. Prior to v0.6.0, the default NULL causes the function to guess which axis is the categorical one based on the number of unique entries in each. This could result in unexpected results when the x variable has few unique values and so in v0.6.0 the default was changed to always jitter on the x axis unless groupOnX=FALSE. Also consider coord_flip
.
Amount by which points from different aesthetic groups will be dodged. This requires that one of the aesthetics is a factor.
integer Resolution of the rastered image in dots per inch (default=300).
string Specifies the device used, which can be one of: "cairo"
, "ragg"
or "ragg_png"
(default="cairo").
numeric Scaling factor to modify the raster object size (default=1). The parameter 'scale=1' results in an object size that is unchanged, 'scale'>1 increase the size, and 'scale'<1 decreases the size. These parameters are passed to 'height' and 'width' of grid::grid.raster(). Please refer to 'rasterise()' and 'grid::grid.raster()' for more details.
geom_quasirandom plot with rasterized layer
geom_point()
understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
fill
group
shape
size
stroke
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
# NOT RUN {
library(ggplot2)
library(ggrastr)
ggplot(mtcars) + geom_quasirandom_rast(aes(x = factor(cyl), y = mpg), raster.dpi = 600)
# }
Run the code above in your browser using DataLab