[R] Concatening two maps/shapefiles...

MacQueen, Don macqueen1 at llnl.gov
Mon Feb 5 21:54:01 CET 2018

I would try using the xlim, ylim arguments in your first map() command, and then using the add argument in the second one. See the help page for the map function.

This assumes that the map() function you are using comes from the maps package.

Otherwise, perhaps you should be using the rgdal package to load your shapefiles into R (you did mention shapefiles), and the basic plot() command to plot them. Depending on whether you choose to use the 'sp' package or the 'sf' package.

See also the R-sig-geo mailing list.


Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
Lab cell 925-724-7509
On 2/5/18, 10:40 AM, "R-help on behalf of Nicolas Degallier" <r-help-bounces at r-project.org on behalf of nicolas.degallier at free.fr> wrote:

    Dear All,
    I'm new with mapping and using shapefiles in R.
    I use the version: R 3.2.1 GUI 1.66 with Snow Leopard Mac OS (6956)
    I want to build a map of the countries of Africa, in order to add points of collecting species of beetles, for later publishing.
    When I put the extreme coordinates of Africa, the map began only at longitude 0° and thus lacks the west africa part:
    x<-map('world2Hires', xlim=c(-18,52), ylim=c(-35,38))
    I attempted with the following script:
    E<-map('world2Hires', xlim=c(0,52), ylim=c(-35,38))
    W<-map('world2Hires', xlim=c(342,360), ylim=c(-35,38))
    It ran fine but now I don't know how to get these two maps jointed.
    I guess it may be trivial but I didn't found nothing about this in the available tutorials.
    Nicolas Degallier
    Nicolas Degallier
    120 rue de Charonne
    F-75011 Paris
    nicolas.degallier at free.fr
    Publications :
    R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
    PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
    and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list