View source: R/Cartesianxy2Polarxy.R
Cartesianxy2Polarxy | R Documentation |
Used in the 'loonLayer' construction to access the x, y positions embedded in the polar coordinate system.
Cartesianxy2Polarxy(layerGeom, coordinates, data, ggplotPanelParams, ...)
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 |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.