Dear R help list,
 
I am working on some data from a study on the habitat use and movement patterns 
of fish using a marine protected area in Hawaii.  We have a number of acoustic 
receivers in a MPA, and any time a tagged fish passes within range it records 
the date and time of detection.  I am trying to make bubble plots showing the 
number of detections for each fish at each receiver.  I have been able to get 
it to work using a map generated from GSHHS data (Global Self-consistent, 
Hierarchical, Highresolution Shoreline) but the map data is not of high enough 
resolution.  Instead I am trying to plot the data on a shapefile, but I can't 
find out how to project the shapefile correctly to match up with the data.  I 
know my shapefile is in NAD 1983 UTM Zone 4N and my data is in WSG84.  How do I 
change the projections to make them line up?  I tried mapproj but couldn't get 
it to work.  Any suggestions would be greatly appreciated. 
 
My code is below.  I have also attached the shapefile and my data.
 
Thanks in advance for your help.
 
Aloha,
 
Tim
 
 
 
 
#Read ESRI shapefiles
library(maptools)
library (PBSmapping)
setwd("E:/Telemetry_research/Kealakekua Bay MPA study/R bubble plot")
hawaii.coast<- read.shape("coast_n83.shp")
 
#Read data and convert to event data
  mydat<-read.table("my.event", header=TRUE)
  my.event<-as.EventData(mydat,projection="LL")
 
#Calculate bubble size
  detects<-mydat$Detections
  max.symbol.size=10
  min.symbol.size=1
  bubble.size <- 
(detects-min(detects))/((max(detects)+.0001)-min(detects))*(max.symbol.size-min.symbol.size)+min.symbol.size     
 #Calculates bubble size as a range between min and max.  0.0001 added to avoid 
division by zero if only one sample.
 
#Plot of all Hawaiii showing point data somewhere to the south.  Needs 
projcting?
plot(hawaii.coast,xlab="Longitude",ylab="Latitude",main="Kealakekua Bay")
addPoints(my.event, pch=19 ,col="red",cex=500)
 
 
 
#Plot of location where point data should be
plot(hawaii.coast,xlim=c(820000, 824000), ylim=c(2154000, 
2158000),xlab="Longitude",ylab="Latitude",main="Kealakekua Bay")



      
"EID" "X" "Y" "Detections" "Transmitter"
"1" 1 -155.932 19.482 63 782
"2" 2 -155.934 19.4779 1 782
PROJCS["NAD_1983_UTM_Zone_4N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-159.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to