Skip to content

Commit cf9fab3

Browse files
committed
CoordRadial: fix wrong coord_limits when view scales
1 parent fc4fe67 commit cf9fab3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

R/coord-radial.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ CoordRadial <- ggproto("CoordRadial", Coord,
161161
},
162162

163163
setup_panel_params = function(self, scale_x, scale_y, params = list()) {
164-
164+
if (self$theta == "x") {
165+
xlimits <- self$limits$theta
166+
ylimits <- self$limits$r
167+
} else {
168+
xlimits <- self$limits$r
169+
ylimits <- self$limits$theta
170+
}
165171
params <- c(
166-
view_scales_polar(scale_x, self$theta, self$limits$theta,
172+
view_scales_polar(scale_x, self$theta, xlimits,
167173
expand = params$expand[c(4, 2)]
168174
),
169-
view_scales_polar(scale_y, self$theta, self$limits$r,
175+
view_scales_polar(scale_y, self$theta, ylimits,
170176
expand = params$expand[c(3, 1)]
171177
),
172178
list(bbox = polar_bbox(self$arc, inner_radius = self$inner_radius),

0 commit comments

Comments
 (0)