[R] labels on map

Duncan Murdoch murdoch at stats.uwo.ca
Tue May 31 02:29:41 CEST 2005

jose silva wrote:
> dear all:
> Im trying to obtain maps on R, under mapdata library, but I cannot define the labels.
> Here is an example:
> library(mapdata)
> map("worldHires", c("portugal","spain"),ylim=c(34,46),xlim=c(-14,3.5))
> axis(1,at=seq(-12,3,3))
> axis(2)
> when I try the parameter xlab or ylab in axis, i get: 
> parameter "ylab" couldn't be set in high-level plot() function 
> any suggestion?  thanks in advance for your always useful advices

Despite their names, x and y axis labels aren't really part of the axis, 
they're titles in the margins of the plot.  Use the title() function to 
set them.

You could probably also set them in map(), but I don't have it installed 
to check.  mtext() is another general purpose way to put text in the 

Duncan Murdoch

More information about the R-help mailing list