geom_azimuthpoint() draws line segments (spokes) like geom_azimuth(), but also
places a point (marker) at the spoke's center (x, y).
Aesthetic rules:
linewidth,linetypeaffect the spoke onlyshapeaffects the point onlycolour,alphaaffect both spoke and pointsizesets the size of the point only
Usage
geom_azimuthpoint(
mapping = NULL,
data = NULL,
stat = "identity",
center = TRUE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
size = 2,
...
)Arguments
- mapping
Set of aesthetic mappings created by
aes(). If specified andinherit.aes = TRUE(the default), it is combined with the default mapping at the top level of the plot. You must supplymappingif there is no plot mapping.- data
The data to be displayed in this layer. There are three options:
If
NULL, the default, the data is inherited from the plot data as specified in the call toggplot().A
data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. Seefortify()for which variables will be created.A
functionwill be called with a single argument, the plot data. The return value must be adata.frame, and will be used as the layer data. Afunctioncan be created from aformula(e.g.~ head(.x, 10)).- stat
The statistical transformation to use on the data for this layer. When using a
geom_*()function to construct a layer, thestatargument can be used to override the default coupling between geoms and stats. Thestatargument accepts the following:A
Statggproto subclass, for exampleStatCount.A string naming the stat. To give the stat as a string, strip the function name of the
stat_prefix. For example, to usestat_count(), give the stat as"count".For more information and other ways to specify the stat, see the layer stat documentation.
- center
Logical; if
TRUE(the default) spokes are centered on (x, y) usingPositionCenterSpoke- useful for axial data. IfFALSE, behaves likeggplot2::geom_spoke()(line starts at (x, y)) - useful for directional data (especially when in combination witharrow()).- na.rm
If
FALSE, the default, missing values are removed with a warning. IfTRUE, missing values are silently removed.- show.legend
logical. Should this layer be included in the legends?
NA, the default, includes if any aesthetics are mapped.FALSEnever includes, andTRUEalways includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, useTRUE. IfNA, all levels are shown in legend, but unobserved levels are omitted.- inherit.aes
If
FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g.annotation_borders().- size
Size of the point marker (default = 2).
- ...
Other arguments passed on to
ggplot2::layer(). These are often aesthetics (e.g.colour,linetype,linewidth,alpha).
Aesthetics
geom_azimuthpoint() understands the following aesthetics (required aesthetics in bold):
x
y
angle (in degrees, measured clockwise from North; transformed internally; spoke only)
radius (spoke only)
colour (shared)
alpha (shared)
linewidth (spoke only)
linetype (spoke only)
shape (point only)
size (point only, or via argument)
fill (point only, for shapes that accept fill)
Examples
set.seed(20250411)
df <- data.frame(
x = runif(5), y = runif(5),
angle_deg = rvm(5, mean = 90, kappa = 10),
radius = runif(5, 0.1, 1),
group = rep(1:2, length.out = 5)
)
if (require("ggplot2")) {
ggplot(data = df, aes(x, y, angle = angle_deg, radius = radius)) +
geom_azimuthpoint(aes(colour = factor(group), shape = factor(group)),
linewidth = 1.1, linetype = "dashed",
size = 3, alpha = 0.8
)
}
