Description Usage Arguments Details Value Functions Examples
Extensions of scale_x_continuous
and scale_y_continuous
that
are useful for circular axes.
1 2 3 4 5 6 7 | scale_circular(units = "degrees", nticks = 4, digits = 0,
limits = c(-pi, pi), positive_labels = TRUE,
scale_function = ggplot2::scale_x_continuous, ...)
scale_x_circular(...)
scale_y_circular(...)
|
units |
The units to display on the axis. See 'Details' for the options. |
nticks |
The number of ticks to display. Only relevant for continous scales. |
digits |
Numeric; The number of digits for continuous scales. |
limits |
Numeric vector; The limits of the plot. Must two numbers that
are |
positive_labels |
Logical; whether to only use positive values for the labels. |
scale_function |
The scale function from ggplot to use. Either
|
... |
Additional arguments to be passed to |
Behind the screens, radians will be used, but the plot will display transformed values.
The input data of the plot on which a scale_circular
is placed,
therefore, must be given in radians, in the range provided in the option
limits
.
The continuous transformations are "radians"
and "degrees"
, for
which digits
can be set.
The temporal transformations are "months"
, "months_abb"
(abbreviated), and "hours"
. For both of these types of
transformations, nticks
.
The categorical transformations are "cardinal"
, which prints character
labels of the directions (left, right, up, down), and "compass"
, which
prints compass directions (North, South, East, West). Both of these assume
the circular data starts on the right and moves counterclockwise. If not,
appropriate transformations must first be taken, or the labels will be
non-sensical.
Two additional labels are "texpi"
and "texnegpi"
, which print
nice labels for TeX to interpret starting at 0 and -pi
respectively.
This is useful if TikZ is used.
An object of type ScaleContinuousPosition
that can be added to
any existing ggplot
.
scale_x_circular
: If circular data is on the x-axis.
scale_y_circular
: If circular data is on the y-axis.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | dat <- rvm(100)
p <- plot(vm_posterior(dat), polar_coord = FALSE)
p + scale_x_circular(units = "compass")
p + scale_x_circular(units = "cardinal")
p + scale_x_circular(units = "texnegpi")
p + scale_x_circular(units = "hours", nticks = 24)
dat <- data.frame(th = rvm(100) + pi)
p + scale_x_circular(units = "months", nticks = 6, limits = c(0, 2*pi))
p + scale_x_circular(units = "months_abb", nticks = 12, limits = c(0, 2*pi))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.