[R-sig-Geo] graphical doubts: lines colour, order objects and print in only one graph
Marta Rufino
mrufino at cripsul.ipimar.pt
Tue May 15 16:11:44 CEST 2007
Dear list members,
I have three doubts: :-)
1. How to colour the lines from a shape file (which has been inserted
into a spplot, through sp.layout):
#For example
nc <- readShapeLines("costa.shp", proj4string=CRS("+proj=longlat
+datum=WGS84"))
spplot(grid[1], sp.layout=list(nc))
#How do I indicate the colour of the lines in the graph? Sorry I dont
give a real example... was unable to find shp+gridded data to fit in
2. How to include a dataframe with text into spplot (i.e. several text
positions in the graph). I managed to do it for one point, but not for
many at the same time. Is it possible?
data(meuse.grid); coordinates(meuse.grid) = c("x", "y");
gridded(meuse.grid) = TRUE #insert data
tx1=data.frame(t(bbox(coordinates(meuse.grid))), lab=c("Bom dia","Boa
tarde"))#text labels to plot, for example...
tx1 = list("sp.text", loc=tx1[1,1:2], tx1$lab[1] ,col = "brown", cex=.5,
pos=3)
spplot(meuse.grid, sp.layout=list(tx1)) #map... works because it is only
one label
tx1=data.frame(t(bbox(coordinates(meuse.grid))), lab=c("Bom dia","Boa
tarde"))#text labels to plot, for example...
tx1 = list("sp.text", loc=tx1[,1:2], tx1$lab ,col = "brown", cex=.5, pos=3)
spplot(meuse.grid, sp.layout=list(tx1)) #map... does not work
3. How do I define that the lines/text should only appear in the first
plot (if I have multiple plots)?
spplot(meuse.grid, sp.layout=list(tx1)) # If I wanted that the labels
only appear in the soil plot, not in the others
Thank you very much in advance,
Best wishes,
Marta
>
--
.......................................................................
Marta M. Rufino (PhD)
.....
Instituto Nacional de Investigação Agrária e das Pescas (INIAP/IPIMAR),
Centro Regional de Investigação Pesqueira do Sul (CRIPSul)
Avenida 5 de Outubro s/n
P-8700-305 Olhão, Portugal
+351 289 700 541
.....
Institut de Ciències del Mar - CMIMA (CSIC)
Passeig Marítim de la Barceloneta, 37-49
08003 BARCELONA - Catalunya
Spain
More information about the R-sig-Geo
mailing list