Use the "bubble" command in gstat.
-Roy M.
On Jan 9, 2009, at 5:58 PM, t c wrote:
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")
<
my.event><coast_n83.prj>______________________________________________
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.
**********************
"The contents of this message do not reflect any position of the U.S.
Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097
e-mail: roy.mendelss...@noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/
"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
______________________________________________
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.