[R] How can I get contour plot on this data?

Mao Jianfeng jianfeng.mao at gmail.com
Thu Nov 12 14:40:48 CET 2009


Dear R-listers,

I have a data set which combine population (site name), longitude,
latitude, altitude, initial (for flowering of a plant), and end (also
for flowering of the same plant) of each site.

Now, I want to make contour plot to display the initial or end of the
spatial pattern of flowering especially, I failed, although I have
tried my best to do that.

Please give me some directions on that. Thank you in advance.

data and codes used are as followed:

1. data
Population	Lon	Lat	Alt	Initial	End
ZDPd01	98.8763	28.4419	3449	2009-4-15	2009-4-25
GSPy01	98.63446667	28.01211667	1736	2009-3-15	2009-3-28
KDPd01	101.9054667	30.18946667	2914	2009-4-18	2009-4-29
MKPd01	102.2027833	31.90801667	2526	2009-4-22	2009-5-1
LXPd01	102.8014833	31.66243333	2746	2009-4-9	2009-4-21
LXPd02	103.0387	31.40156667	2158	2009-4-7	2009-4-19
BXPd01	102.75395	30.71616667	2180	2009-4-5	2009-4-14
XJPd01	102.5218	31.02406667	2467	2009-4-2	2009-4-9
BJPt01	115.95	40.45	80	2009-4-19	2009-4-26
KMPd01	102.6225761	24.96880965	1900	2009-3-22	2009-4-11
NYPd06	94.08488239	29.73718216	3379.591549	2009-5-1	2009-5-7
PLPd02	95.49816933	29.90361244	2650.12	2009-4-26	2009-5-5
CYPd01	97.01336034	28.50232574	1631.607595	2009-4-15	2009-4-23
CYPd02	97.47131095	28.67033436	2431.802469	2009-4-21	2009-5-2
CYPd03	97.22515032	29.13309676	3263.019417	2009-4-25	2009-5-3
NCPt01	118.97	42.28	1300	2009-5-25	2009-6-1
QLPd01	103.6905774	37.44786532	2403.370968	2009-5-15	2009-5-23
LKSPt01	112.0359546	36.61293704	1664.597938	2009-4-21	2009-5-11

2. code

phen<-read.delim("2009phenology.txt", header=T)
str(phen)
phen.1<-phen[,1:7]
phen.1[,6]<-as.Date(phen.1[,6])
phen.1[,7]<-as.Date(phen.1[,7])
str(phen.1)

phen.2<-phen.1[order(phen.1[,3], phen.1[,4]),]
fix(phen.2)

contour(phen.2$Lon, phen.2$Lat, phen.2$Initial) # failed
contour(phen.2$Lon, phen.2$Lat, phen.2$Alt) # failed

Regards,

Mao J-F




More information about the R-help mailing list