geom_point_trace {ggtrace} | R Documentation |
Trace points
Description
This geom is similar to ggplot2::geom_point()
, but also includes the
ability to outline points of interest. geom_point_trace()
accepts
normal ggplot2 graphical parameters with some modifications. fill
controls the color of each point, color
controls the outline
color, and stroke
controls outline width, similar to how filled
shapes are modified for other ggplot2 geoms. Additional parameters including
size
, linetype
, and alpha
are also accepted.
Usage
geom_point_trace(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
trace_position = "all",
background_params = list(color = NA),
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, 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 |
trace_position |
Specifies which data points to outline, can be one of:
|
background_params |
Named list specifying aesthetic parameters to use
for background data points when a predicate is passed to
|
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Value
ggplot object
Aesthetics
geom_point_trace()
understands the following aesthetics (required aesthetics are in bold):
-
x
-
y
-
alpha
-
colour
-
fill
-
group
-
linetype
-
shape
-
size
-
stroke
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
See Also
Examples
# Modify outline color for each group
ggplot2::ggplot(
clusters,
ggplot2::aes(UMAP_1, UMAP_2, color = cluster)
) +
geom_point_trace() +
ggplot2::theme_minimal()
# Outline a subset of points
ggplot2::ggplot(
clusters,
ggplot2::aes(UMAP_1, UMAP_2, fill = cluster)
) +
geom_point_trace(trace_position = signal < 0 | signal > 17) +
ggplot2::theme_minimal()
# Modify appearance of background points
ggplot2::ggplot(
clusters,
ggplot2::aes(UMAP_1, UMAP_2, fill = cluster)
) +
geom_point_trace(
trace_position = signal < 0 | signal > 17,
background_params = list(color = NA, fill = "grey85")
) +
ggplot2::theme_minimal()