View source: R/CrossExpression.R
rotate_coordinates | R Documentation |
This function takes x and y coordinates and rotates them counterclockwise by the specified number of degrees, and mean centers the points.
rotate_coordinates(
x,
y,
n_degrees = 0,
center = FALSE,
scale = FALSE,
flip_x = FALSE,
flip_y = FALSE
)
x |
The x coordinates. |
y |
The y coordinates. |
n_degrees |
The degree of rotation in counterclockwise direction. |
center |
If TRUE, mean centers the points. |
scale |
If TRUE, standardizes the points. |
flip_x |
Reflects the points across y = 0 line. |
flip_y |
Reflects the points across x = 0 line. |
Returns a data frame containing the new x and y coordinates.
data("locations")
locations = as.data.frame(as.matrix(locations))
ggplot2::ggplot(data = locations) + ggplot2::aes(x = pos_x, y = pos_y) +
ggplot2::geom_point(size = 0) + ggplot2::theme_classic()
locations = rotate_coordinates(x = locations$pos_x, y = locations$pos_y, n_degrees = 45)
ggplot2::ggplot(data = locations) + ggplot2::aes(x = pos_x, y = pos_y) +
ggplot2::geom_point(size = 0) + ggplot2::theme_classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.