Skip to content

Commit bde4d66

Browse files
author
markpayneatwork
committed
Minor tweaks to match ggplot2 style
1 parent ff944e4 commit bde4d66

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ ggplot2 1.0.0
1212

1313
NEW FEATURES
1414

15+
* `borders()` now accepts xlim and ylim arguments for specifying the geographical
16+
region of interest (@markpayneatwork, #1392)
17+
1518
* New coordinate system for small scale maps. `coord_quickmap()` computes and
1619
sets the correct aspect ratio between one degree of latitude and one degree
1720
of longitude at the centre of the plotted region. It does not perform full

R/fortify-map.r

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ map_data <- function(map, region = ".", exact = FALSE, ...) {
7474
#' @param regions map region
7575
#' @param fill fill colour
7676
#' @param colour border colour
77-
#' @param "xlim, ylim" map xlim and ylim,, see \code{\link[maps]{map}} for details
77+
#' @param xlim,ylim latitudinal and logitudinal range for extracting map polygons, see \code{\link[maps]{map}} for details
7878
#' @param ... other arguments passed onto \code{\link{geom_polygon}}
7979
#' @export
8080
#' @examples
@@ -97,13 +97,13 @@ map_data <- function(map, region = ".", exact = FALSE, ...) {
9797
#' #Same map, with geographical context
9898
#' data(us.cities)
9999
#' capitals <- subset(us.cities, capital == 2)
100-
#' ggplot(capitals,aes(long,lat)) +
101-
#' borders("world",xlim=c(-130,-60),ylim=c(20,50))+
100+
#' ggplot(capitals, aes(long, lat)) +
101+
#' borders("world", xlim = c(-130, -60), ylim = c(20, 50)) +
102102
#' geom_point(aes(size = pop)) +
103-
#' scale_size_area()+coord_quickmap(xlim=c(-130,-60),ylim=c(20,50))
103+
#' scale_size_area() + coord_quickmap(xlim = c(-130, -60), ylim = c(20, 50))
104104
#' }
105105
borders <- function(database = "world", regions = ".", fill = NA, colour = "grey50", xlim=NULL,ylim=NULL,...) {
106-
df <- map_data(database, regions,xlim=xlim,ylim=ylim)
106+
df <- map_data(database, regions, xlim = xlim, ylim = ylim)
107107
geom_polygon(aes_(~long, ~lat, group = ~group), data = df,
108108
fill = fill, colour = colour, ..., inherit.aes = FALSE)
109109
}

0 commit comments

Comments
 (0)