Cartesianxy2Polarxy {loon.ggplot} | R Documentation |
Transform the x, y positions from a Cartesian coordinate to a polar coordinate
Description
Used in the 'loonLayer' construction to access the x, y positions embedded in the polar coordinate system.
Usage
Cartesianxy2Polarxy(layerGeom, coordinates, data, ggplotPanelParams, ...)
Arguments
layerGeom |
A |
coordinates |
A |
data |
the data used for the transformation |
ggplotPanelParams |
some non-data panel parameters,
i.e. the range of theta, the range of radius, theta major, theta minor, etc. It is obtained from the
|
... |
for further use |
Examples
p <- ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
coord_polar()
layerGeom <- p$layers[[1L]]$geom
coordinates <- p$coordinates
build <- ggplot_build(p)
data <- build$data[[1L]]
ggplotPanelParams <- build$layout$panel_params[[1L]]
polarXY <- Cartesianxy2Polarxy(layerGeom, coordinates, data, ggplotPanelParams)
plot(polarXY$x, polarXY$y)
[Package loon.ggplot version 1.3.4 Index]