-1

I have a dataset with biological groups and its geographic information:

results2

ID  Latitude    Longitude
A   -3,5     -39,5833
A   -7,0167  -37,9667
A   -9,2258  -43,4631
B   -16,6667 -49,5
B   -15,4333 -55,75
B   -19,0333 -57,2167
C   -29,2    -58,1
C   -30      -59,5167
C   -34,5667 -59,1167

I used maptools for plotting these points on a map, here the code:

xlim<-c(min(results2$Longitude),max(results2$Longitude)) 
  ylim<-c(min(results2$Latitude),max(results2$Latitude))
  readShapeLines("americas_adm0.shp") -> shape
  plot(shape, xlim=xlim, ylim=ylim)
  par(new=TRUE)
  ## vamos aqui!!
  pontos<- data.frame(results2$Longitude,results2$Latitude)
  colnames(pontos)=c("Longitude","Latitude")
  points(pontos$Longitude, pontos$Latitude, pch=16, col=2, cex=1)

But i dont know how to delimit polygons for each group, and change the color options of the studied groups.

tonytonov
  • 25,060
  • 16
  • 82
  • 98
  • My apologies, i did not explain well: I plotting the map and the points with "maptools": `xlim<-c(min(results2$Longitude),max(results2$Longitude)) ylim<-c(min(results2$Latitude),max(results2$Latitude)) readShapeLines("americas_adm0.shp") -> shape plot(shape, xlim=xlim, ylim=ylim) par(new=TRUE) pontos<- data.frame(results2$Longitude,results2$Latitude) colnames(pontos)=c("Longitude","Latitude") points(pontos$Longitude, pontos$Latitude, pch=16, col=2, cex=1)` But i dont know how to elaborate the polygons of each group. – Sergio Bolívar May 17 '14 at 11:19

1 Answers1

-1

I'm not sure I understand what you mean by "the polygons of each group" ? Are you perhaps refering to what is known as a "convex hull" : in this case quite a few GIS packages (such as sp) should supply the fiunctionality...

jfmoyen
  • 495
  • 2
  • 11