Used in the `loonLayer` construction to access the x, y positions embedded in the polar coordinate system.

Cartesianxy2Polarxy(layerGeom, coordinates, data, ggplotPanelParams, ...)

Arguments

layerGeom

A ggplot layer object

coordinates

A ggplot object coordinate system

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 ggplot_build(p)$layout$panel_params where "p" is a ggplot object

...

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)