[R-sig-Geo] aligning tick maks with coord_map and ggplot

zuzana zajkova zuzulaz at gmail.com
Tue Nov 14 11:44:51 CET 2017


Hi Andy,

try the geom_sf (not sure now but probably you would need the dev. version
of ggplot2).
Check http://ggplot2.tidyverse.org/reference/ggsf.html

library(maps)
world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE))
ggplot() + geom_sf(data = world1)

Projected:
ggplot() +
  geom_sf(data = world1, colour="gray50", fill="gray50") +
  coord_sf(crs="+proj=ortho +y_0=0 +lon_0=-110 +lat_0=40", xlim=c(-2000000,
500000), ylim=c(-1800000, 2000000)) +
  scale_x_continuous(breaks=seq(-140, -100, 10)) +
  scale_y_continuous(breaks=seq(10, 60, 10))

Best,

Zuzana

________________________________________

*Zuzana Zajková*
PhD. student
Department of Evolutionary Biology, Ecology and Environmental Sciences |
Vertebrates
Faculty of Biology | University of Barcelona
Av. Diagonal 643, 08028  Barcelona, Spain
Email: zuzulaz at gmail.com

On 13 November 2017 at 20:40, Andy Bunn <Andy.Bunn at wwu.edu> wrote:

> Hi all, given the map below is there an easy way to align the tick marks
> and text with the graticule? Many thanks, Andy
>
> p1 <- ggplot() + borders("world", colour="gray50", fill="gray50")
> p1 <- p1 + coord_map("ortho", orientation = c(40, -110, 0),
>                      xlim=c(-133,-96),ylim=c(17,54))
> p1
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list