I'm trying to plot the spatial distribution of the precipitation within an area. However, I think some thing wrong with the way to create the matrix for the precipitation data, so it came out lots of stripes. Could somebody help to see what's the problem?
Here's the code: library(maptools);gpclibPermit() KSR <- readShapeLines("/Users/R/Code/data/KS_River_Basin_Dissolve.shp") states <- readShapeLines("/Users/R/Code/data/statesp020.shp") ppt <- read.table ('/Users/R/Code/LULC/pptnewlulc.dat', header = FALSE) # the size is 5764(pixels) x 528(periods) ppt <- (ppt/100)*25.4 #convert from hundredths of an inch to mm # the range of the area plat <- as.matrix(seq(38.16836,41.29575,by=0.07273)) #dimension is (44,1) plon <- as.matrix(seq(-103.9752,-94.5,by=0.07273)) #dimension is (131,1) ppt1 <- ppt[,1] #length is 5764 ppt1 <- matrix(as.numeric(ppt[,1]), nrow=131, ncol=44) > ppt1 [1] 1.6107435 1.6964510 1.7840456 1.8703002 1.9060464 1.8331288 [7] 1.7492645 1.6657609 1.5836155 1.5029230 1.4235667 1.3453415 [13] 1.2679848 1.1911846 1.1145816 1.0377716 0.9603123 0.8817440 [19] 0.8016514 0.7197971 0.6358195 0.5491863 0.4597592 0.3679972 [25] 0.2760894 0.1982588 0.2476851 0.4162456 0.5978296 0.7801869 [31] 0.9613614 1.1406394 1.3174150 1.4908873 1.6599098 1.8228706 [37] 1.9775737 2.1211284 2.2498808 2.3594647 2.4450861 2.5021472 [43] 2.5271773 2.5187691 2.4780429 2.4083549 2.3144392 2.2014557 [49] 2.0743049 1.9372928 1.7940577 1.6476393 1.5006009 1.3551586 [55] 1.2132956 1.0768556 0.9476100 0.8272998 0.7176445 0.6203169 [61] 0.5368747 0.4686491 0.4165842 0.3810237 0.3614115 0.3558352 [67] 0.3604144 0.3694904 0.3789373 0.3893489 0.4031113 0.4213572 [73] 0.4439491 0.4701542 0.4990731 0.5298432 0.5617263 0.5941408 [79] 0.6266697 0.6590616 0.6912338 0.7232838 0.7555102 0.7884400 [85] 0.8228393 0.8596634 0.8998832 0.9441835 0.9926862 1.0449394 [91] 1.1002318 1.1580500 1.2185293 1.2829580 1.3546013 1.4403309 [97] 1.5538225 1.7202595 1.9752756 2.3408103 2.7993614 3.3147553 [103] 3.8596185 4.4187127 4.9842972 5.5526464 6.1222320 6.6928247 [109] 7.2650406 7.8401020 8.4197039 9.0059336 9.6012140 10.2082516 [115] 10.8299745 11.4694468 12.1297462 12.8137955 13.5241426 14.2626950 . . . [5701] 1.7727924 1.6088669 1.4597899 1.3320119 1.2334596 1.1726128 [5707] 1.1558909 1.1843496 1.2525310 1.3494515 1.4487511 1.4685923 [5713] 1.4405088 1.4147032 1.3983221 1.3934889 1.4017653 1.4242208 [5719] 1.4609696 1.5109698 1.5722817 1.6425184 1.7190923 1.7990668 [5725] 1.8786622 1.9527120 2.0148606 2.0596097 2.0856556 2.0971253 [5731] 2.1013309 2.1062371 2.1197684 2.1495620 2.2009875 2.2741332 [5737] 2.3639327 2.4640252 2.5699179 2.6796082 2.7929445 2.9106359 [5743] 3.0326922 3.1552148 3.2630879 3.3140082 3.2330736 3.0048286 [5749] 2.6999823 2.3698632 2.0349915 1.7047147 1.4003574 1.1866439 [5755] 1.0745487 1.0187572 1.0105229 1.0508374 1.1396213 1.2764772 [5761] 1.4637501 1.7146081 2.0986433 3.0352581 quartz() filled.contour(plon,plat,t(ppt1),col=rainbow(20),plot.axes={axis(1);axis(2);lines(KSR,lwd=2,col='brown');lines(states)}) Thanks for help, Peiling Lin ______________________________________________ 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.