Learn R Programming

geo (version 1.4-3)

geotext: Plots text on a drawing defined by geoplot.

Description

The function plots a text in each of the points defined by lat,lon. (or x,y) The value plotted at each point is defined by the numeric vector or text vector z. Simular to text but allows lat and lon and a choice of digits used.

Usage

geotext(lat, lon = 0, z, cex = 0.7, adj = 0.5, col = 1, digits = 0, pretext = "", lwd = 0, aftertext = "", outside = F, angle = 0, jitter = NULL, csi = NULL)

Arguments

lat,lon
Latitude and longitude of data ( or x and y coordinates), negative for southern latitudes and western longitudes. May be supplied as two vectors or as a list lat (or x) including vectors lat\$lat and lat\$lon (x\$x and x\$y if projection = none).
z
Vector with values that will be plotted at datapoints. Has to be of the same length as lat. If z is of mode character it is written directly on the screen.
cex
Relative size of characters (see the help on the parameter cex). The size of plotted characeters is cex time the parameter csi that can be seen by par()\$csi. In earlier versions of geoplot the parameter csi was set but csi is a parameter that can not be set in R.
adj
Location of the text relative to the point, 0 means text right of point, 0.5 text centered at point and 1 text left of point. Default value is 0.5.
col
Color number used. Default value is 1.
digits
Number of digits used.
pretext
Text put in front of all the text. Default value is nothing.
lwd
Linewidth used.
aftertext
Text put after all the text. Default value is nothing.
outside
If outside is F no text is plotted outside the range defined by xlim,ylim. Else it is done. Default value is F.
angle
angle of text in degrees, default is 0.
jitter
see jitter in geoplot.
csi
Size of character. This parameter can not be set in R but for compatibility with old Splus scripts the parameter cex is readjusted by cex = cex*csi/0.12. Use of this parameter is not recommended. Default value is NULL i.e not used.

Value

No values returned.

See Also

geoplot, geopolygon, geolines, geosymbols, geogrid, geopar, geocontour.fill, geolocator, geocontour.

Examples

Run this code
## Not run:        geotext(deg,z=z)    # plot text at points deg$lat,deg$lon
# 
#        geotext(deg$lat,deg$lon,z,csi=0.06) # Same, size of text 0.06".
# 
#        geotext(x$x,x$y,x$z,aftertext="km",pretext="distance")
#        # If geopar$projection="none"
# 
#        geotext(x,z=x$z,aftertext=" km",pretext="distance",angle =90)
#        # Same text written vertically.
# 
# 
#        ###############################################################
#        #  Example                                                    #
#        ###############################################################
# 
#        lon <- rnorm(10,-27,1.3)
#        lat <- rnorm(10,65,0.6)
#        # Make a normal dist. random set of 10 points.
# 
#        geoplot(lat=lat,lon=lon,grid=F,xlim=c(-22,-30),ylim=c(63,67))
#        # Plot the random data points.
# 
#        geopolygon(island,col=115,exterior=T)
#        geolines(island)
#        # Color Iceland. Use litir(number) to see colour scheme.
#        # Sharpen lines around Iceland.
# 
#        num <- 1:10
#        lab <- paste("Nr.",num,sep="")
#        # Make string vector with "Nr.1".."Nr.10" for geotext.
# 
#        geopoints(lat,lon,pch="*",col=5)
#        # Redraw the data in a new color the * mark at points.
# 
#        geotext(lon=lon,lat=lat,z=lab,col=155)
#        # With geotext we put one element from lab at each data point.
#        title(main="10 Random Data Point")
#        # Add title
# ## End(Not run)

Run the code above in your browser using DataLab