View source: R/geom_tileglyph.R
geom_tileglyph | R Documentation |
The tileglyph geom is used to plot multivariate data as tile glyphs similar to 'autoglyph' \insertCitebeddow_shape_1990gglyph or 'stripe glyph' \insertCitefuchs_evaluation_2013gglyph in a scatterplot.
geom_tileglyph( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., cols = character(0L), colour = "black", ratio = 1, nrow = 1, linewidth = 1, fill.gradient = NULL, show.legend = NA, repel = FALSE, repel.control = gglyph.repel.control(), inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
cols |
Name of columns specifying the variables to be plotted in the glyphs as a character vector. |
colour |
The colour of the tile glyphs. |
ratio |
The aspect ratio (height / width). |
nrow |
The number of rows. |
linewidth |
The line width of the tile glyphs. |
fill.gradient |
The palette for gradient fill of the segments. See
Details section of |
show.legend |
logical. Should this layer be included in the legends?
|
repel |
logical. If |
repel.control |
A list of control settings for the repel algorithm.
Ignored if |
inherit.aes |
If |
A geom
layer.
geom_tileglyph()
understands the following
aesthetics (required aesthetics are in bold):
x
y
alpha
group
size
See vignette("ggplot2-specs", package = "ggplot2")
for further
details on setting these aesthetics.
The following additional aesthetics are considered if repel = TRUE
:
point.size
segment.linetype
segment.colour
segment.size
segment.alpha
segment.curvature
segment.angle
segment.ncp
segment.shape
segment.square
segment.squareShape
segment.inflect
segment.debug
See ggrepel
examples page
for further details on setting these aesthetics.
tileglyphGrob
Other geoms:
geom_dotglyph()
,
geom_metroglyph()
,
geom_pieglyph()
,
geom_profileglyph()
,
geom_starglyph()
# Scale the data zs <- c("hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb") mtcars[ , zs] <- lapply(mtcars[ , zs], scales::rescale) mtcars$cyl <- as.factor(mtcars$cyl) mtcars$lab <- row.names(mtcars) library(ggplot2) theme_set(theme_bw()) options(ggplot2.discrete.colour = RColorBrewer::brewer.pal(8, "Dark2")) options(ggplot2.discrete.fill = RColorBrewer::brewer.pal(8, "Dark2")) ggplot(data = mtcars) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 2, fill.gradient = "Blues", alpha = 0.5) + ylim(c(-0, 550)) ggplot(data = mtcars) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 2, nrow = 2, fill.gradient = "Greens", alpha = 0.5) + ylim(c(-0, 550)) ggplot(data = mtcars) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 1, ratio = 4, fill.gradient = "RdYlBu", alpha = 0.5) + ylim(c(-0, 550)) ggplot(data = mtcars) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 1, ratio = 4, nrow = 2, fill.gradient = "viridis", alpha = 0.5) + ylim(c(-0, 550)) # Repel glyphs ggplot(data = mtcars) + geom_point(aes(x = mpg, y = disp)) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 2, fill.gradient = "Blues", alpha = 1, repel = TRUE) + ylim(c(-0, 550)) ggplot(data = mtcars) + geom_point(aes(x = mpg, y = disp)) + geom_tileglyph(aes(x = mpg, y = disp), cols = zs, size = 1, ratio = 4, nrow = 2, fill.gradient = "viridis", alpha = 1, repel = TRUE) + ylim(c(-0, 550))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.