geom_outline_point {ggh4x} | R Documentation |
Points with outline
Description
This is a variant of the point geom, wherein overlapping points are given a shared outline. It works by drawing an additional layer of points below a regular layer of points with a thicker stroke.
Usage
geom_outline_point(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
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, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Details
Due to the way this geom is implemented, it handles the alpha
aesthetic pretty ungracefully.
Value
A ggplot Layer
Aesthetics
geom_outline_point()
understands the following aesthetics (required aesthetics are in bold):
-
x
-
y
-
alpha
-
colour
-
fill
-
group
-
shape
-
size
-
stroke
-
stroke_colour
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
Examples
# A standard plot
p <- ggplot(mpg, aes(displ, cty, colour = factor(cyl))) +
geom_outline_point(size = 10, stroke = 3)
p
# The colour of the stroke can be mapped to a scale by setting the
# aesthetics to `"stroke_colour"`.
p +
aes(stroke_colour = factor(cyl)) +
scale_colour_hue(
aesthetics = "stroke_colour",
l = 50
)