1
- # ' Cartesian coordinates with an aspect ratio approximating mercator projection.
1
+ # ' Cartesian coordinates with an aspect ratio approximating Mercator projection.
2
2
# '
3
3
# ' The represenation of a portion of the earth, wich is approximately spherical,
4
4
# ' onto a flat 2D plane requires a projection. This is what
26
26
# ' # Create a lat-long dataframe from the maps package
27
27
# ' nz <- map_data("nz")
28
28
# ' # Prepare a plot of the map
29
- # ' nzmap <- ggplot(nz, aes(x= long, y= lat, group= group)) +
30
- # ' geom_polygon(fill= "white", colour= "black")
29
+ # ' nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) +
30
+ # ' geom_polygon(fill = "white", colour = "black")
31
31
# '
32
32
# ' # Plot it in cartesian coordinates
33
33
# ' nzmap
@@ -51,8 +51,8 @@ coord_aspect.quickmap <- function(coord, ranges) {
51
51
52
52
# compute distance corresponding to 1 degree in either direction
53
53
# from the center
54
- x.dist <- dist_central_angle(x.center + c(- 0.5 ,0.5 ), rep(y.center ,2 ))
55
- y.dist <- dist_central_angle(rep(x.center ,2 ), y.center + c(- 0.5 ,0.5 ))
54
+ x.dist <- dist_central_angle(x.center + c(- 0.5 , 0.5 ), rep(y.center , 2 ))
55
+ y.dist <- dist_central_angle(rep(x.center , 2 ), y.center + c(- 0.5 , 0.5 ))
56
56
# NB: this makes the projection correct in the center of the plot and
57
57
# increasingly less correct towards the edges. For regions of reasonnable
58
58
# size, this seems to give better results than computing this ratio from
0 commit comments