|
|
@ -87,7 +87,7 @@ coord_proj <- function(proj=NULL, inverse = FALSE, degrees = TRUE, |
|
|
|
ellps.default = ellps.default, |
|
|
|
degrees = degrees, |
|
|
|
limits = list(x = xlim, y = ylim), |
|
|
|
params= list() |
|
|
|
params= list() # parameters are encoded in the proj4 string |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
@ -219,7 +219,14 @@ CoordProj <- ggproto("CoordProj", Coord, |
|
|
|
}, |
|
|
|
|
|
|
|
render_axis_h = function(self, scale_details, theme) { |
|
|
|
if (is.null(scale_details$x.major)) return(zeroGrob()) |
|
|
|
arrange <- scale_details$x.arrange %||% c("primary", "secondary") |
|
|
|
|
|
|
|
if (is.null(scale_details$x.major)) { |
|
|
|
return(list( |
|
|
|
top = zeroGrob(), |
|
|
|
bottom = zeroGrob() |
|
|
|
)) |
|
|
|
} |
|
|
|
|
|
|
|
x_intercept <- with(scale_details, data.frame( |
|
|
|
x = x.major, |
|
|
@ -227,11 +234,23 @@ CoordProj <- ggproto("CoordProj", Coord, |
|
|
|
)) |
|
|
|
pos <- self$transform(x_intercept, scale_details) |
|
|
|
|
|
|
|
guide_axis(pos$x, scale_details$x.labels, "bottom", theme) |
|
|
|
axes <- list( |
|
|
|
bottom = guide_axis(pos$x, scale_details$x.labels, "bottom", theme), |
|
|
|
top = guide_axis(pos$x, scale_details$x.labels, "top", theme) |
|
|
|
) |
|
|
|
axes[[which(arrange == "secondary")]] <- zeroGrob() |
|
|
|
axes |
|
|
|
}, |
|
|
|
|
|
|
|
render_axis_v = function(self, scale_details, theme) { |
|
|
|
if (is.null(scale_details$y.major)) return(zeroGrob()) |
|
|
|
arrange <- scale_details$y.arrange %||% c("primary", "secondary") |
|
|
|
|
|
|
|
if (is.null(scale_details$y.major)) { |
|
|
|
return(list( |
|
|
|
left = zeroGrob(), |
|
|
|
right = zeroGrob() |
|
|
|
)) |
|
|
|
} |
|
|
|
|
|
|
|
x_intercept <- with(scale_details, data.frame( |
|
|
|
x = x.range[1], |
|
|
@ -239,7 +258,12 @@ CoordProj <- ggproto("CoordProj", Coord, |
|
|
|
)) |
|
|
|
pos <- self$transform(x_intercept, scale_details) |
|
|
|
|
|
|
|
guide_axis(pos$y, scale_details$y.labels, "left", theme) |
|
|
|
axes <- list( |
|
|
|
left = guide_axis(pos$y, scale_details$y.labels, "left", theme), |
|
|
|
right = guide_axis(pos$y, scale_details$y.labels, "right", theme) |
|
|
|
) |
|
|
|
axes[[which(arrange == "secondary")]] <- zeroGrob() |
|
|
|
axes |
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|