White space when printing a full page of a world map

I am trying to get a full section of the world map in PDF A4. When I use the following

pdf("temp.pdf", paper="a4r")
#par(mar=rep(0,4))
map("world", mar = rep(0,4))
dev.off()

I get

enter image description here

I can't seem to get the plot to fill the page. Any tips?

+3
source share
2 answers

Try:

pdf("temp.pdf", paper="a4r",width=0,height=0)
map("world")
dev.off()

which looks weird but works and is mentioned in the docs. This gives me a world map that fills the page left to right, but not top to bottom, because it maintains the aspect ratio.

+7
source

You can extract the coordinates:

coord <- map.poly(database="world", regions=".", exact=FALSE,
        xlim=NULL, ylim=NULL, boundary=TRUE, interior=TRUE, fill=FALSE,
        as.polygon=TRUE)

and then sketch whatever you want with coord$xand coord$y.

+1
source

All Articles