|
4 | 4 | #' @param end Position from 12 o'clock in radians where plot ends, to allow |
5 | 5 | #' for partial polar coordinates. The default, `NULL`, is set to |
6 | 6 | #' `start + 2 * pi`. |
7 | | -#' @inheritParams coord_cartesian |
| 7 | +#' @param thetalim,rlim Limits for the theta and r axes. |
8 | 8 | #' @param expand If `TRUE`, the default, adds a small expansion factor to |
9 | 9 | #' the limits to prevent overlap between data and axes. If `FALSE`, limits |
10 | 10 | #' are taken directly from the scale. |
|
49 | 49 | #' coord_radial( |
50 | 50 | #' start = -0.4 * pi, |
51 | 51 | #' end = 0.4 * pi, inner.radius = 0.3, |
52 | | -#' xlim = c(200, 300), |
53 | | -#' ylim = c(15, 30), |
| 52 | +#' thetalim = c(200, 300), |
| 53 | +#' rlim = c(15, 30), |
54 | 54 | #' clip = "on" |
55 | 55 | #' ) |
56 | 56 | coord_radial <- function(theta = "x", |
57 | 57 | start = 0, end = NULL, |
58 | | - xlim = NULL, ylim = NULL, expand = TRUE, |
| 58 | + thetalim = NULL, rlim = NULL, expand = TRUE, |
59 | 59 | direction = deprecated(), |
60 | 60 | clip = "off", |
61 | 61 | r.axis.inside = NULL, |
@@ -109,7 +109,7 @@ coord_radial <- function(theta = "x", |
109 | 109 | inner.radius <- switch(reverse, thetar = , r = rev, identity)(inner.radius) |
110 | 110 |
|
111 | 111 | ggproto(NULL, CoordRadial, |
112 | | - limits = list(x = xlim, y = ylim), |
| 112 | + limits = list(theta = thetalim, r = rlim), |
113 | 113 | theta = theta, |
114 | 114 | r = r, |
115 | 115 | arc = arc, |
@@ -163,10 +163,10 @@ CoordRadial <- ggproto("CoordRadial", Coord, |
163 | 163 | setup_panel_params = function(self, scale_x, scale_y, params = list()) { |
164 | 164 |
|
165 | 165 | params <- c( |
166 | | - view_scales_polar(scale_x, self$theta, self$limits$x, |
| 166 | + view_scales_polar(scale_x, self$theta, self$limits$theta, |
167 | 167 | expand = params$expand[c(4, 2)] |
168 | 168 | ), |
169 | | - view_scales_polar(scale_y, self$theta, self$limits$y, |
| 169 | + view_scales_polar(scale_y, self$theta, self$limits$r, |
170 | 170 | expand = params$expand[c(3, 1)] |
171 | 171 | ), |
172 | 172 | list(bbox = polar_bbox(self$arc, inner_radius = self$inner_radius), |
|
0 commit comments