Description Usage Arguments Details Value Functions Examples
View source: R/plotFunctions.R
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(0, 2 * pi), 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 continuous scales. |
digits |
Numeric; The number of digits for continuous scales. |
limits |
Numeric vector; The limits of the plot. Must two numbers that
are |
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 continuous transformations are "radians"
, "degrees"
and
"hours"
. For these, nticks
and digits
can be set.
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
nonsensical.
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
: X axis has circular scale.
scale_y_circular
: Y axis has circular scale.
1 2 3 4 5 6 7 8 9 10 11 12 | p <- plot_batmixfit(params = cbind(mu = c(-pi/2, 0, pi/2, pi), kp = 4,
lam = c(-.9, .2, .8, 0), alph = .25))
p + scale_x_circular(units = "compass")
p + scale_x_circular(units = "compass", limits = c(-1, 2*pi - 1))
p + scale_x_circular(units = "cardinal")
p + scale_x_circular(units = "texpi")
p + scale_x_circular(units = "texnegpi")
p + scale_x_circular(units = "hours", nticks = 24)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.