我好像有下面的代码来绘制这个:
我想要做的是让每个小组的大纲遵循每个小组中的所有要点 - 而不是像目前那样跳过其中的一些.另外我希望每个轮廓都有一个半透明的填充.谢谢你的帮助.
library(ggplot2)
library(reshape)
library(car)
G1 <- 1:10
G2 <- 11:20
G3 <- 21:30
G4 <- 31:35
G5 <- 36:41
sdata <- read.csv("http://dl.dropbox.com/u/58164604/sdata.csv", stringsAsFactors = FALSE)
pdata<-melt(sdata, id.vars="Var")
VarArea <- data.frame(unique(pdata$Var))
VarFinalMin <-c()
for (g in 1:max(VarArea))
{
VarNum<-pdata[which(pdata$Var==g),1:c(ncol(pdata))]
VarN <- g
VarMin <- min(VarNum$value)
VarMinN <- cbind(VarN, VarMin)
VarFinalMin <- rbind(VarFinalMin,VarMinN)
}
VFinalMin <- data.frame(VarFinalMin)
colnames(VFinalMin)<-c("Variable", "Value")
VarFinalMax <-c()
for (g in 1:max(VarArea))
{
VarNum<-pdata[which(pdata$Var==g),1:c(ncol(pdata))]
VarN <- g
VarMax <- max(VarNum$value)
VarMaxN <- cbind(VarN, VarMax)
VarFinalMax <- …
Run Code Online (Sandbox Code Playgroud) 我想知道这是否可能做到这一点.
我有一个数据作为SpatialLinesDataFrame,另一个作为spatialPolygonDataFrame.是否有可能覆盖这两个数据?
当我尝试覆盖这些时,我收到以下错误:
jd <- overlay(res,hello)
Error in function (classes, fdef, mtable) : unable to find an inherited method for function
‘overlay’ for signature ‘"SpatialLinesDataFrame", "SpatialPolygonsDataFrame"’
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,res是SpatialLinesDataFrame,hello是SpatialPolygonDataFrame.
我有一个shapefile,然后我有x,y和z坐标的数据点.我想在shapefile上显示轮廓线.
我使用的程序是使用akima包进行插值.我用来插值的代码是
fld <- interp(x,y,z)
Run Code Online (Sandbox Code Playgroud)
然后我使用以下代码将其更改为空间对象:
res <-ContourLines2SLDF(contourLines(fld))
Run Code Online (Sandbox Code Playgroud)
上述命令将轮廓线存储为空间数据.
然后我读取shapefile,我将shapefile和res绘制如下:
p1 <-
spplot(hello,sp.layout=list(list("sp.lines",res)),col="blue",lwd=0,fill="grey",colorkey=F)
p1
Run Code Online (Sandbox Code Playgroud)
"hello"是我的shapefile,"res"是我创建的对象,如上所示.
问题是存储在"res"中的轮廓延伸到shapefile之外.所以我想用shapefile剪切那个轮廓,只显示shapefile区域内的轮廓.
所以我正在寻找一种用多边形图层剪切轮廓图层的方法.
我附上了我的代码所附的图像.
在图像中,您可以看到shapefile中的行.我还想知道如何在地图上显示轮廓水平.
非常感谢.
Jdbaba
我也想知道叠加层到底做了什么.它是否与两个数据的区域相交?
谢谢.
我有一个30秒的CPU数据,如下所示.我想做的是将这些数据合并为5分钟和10分钟的平均值.
dput(head(res,50))
structure(list(DATE = structure(c(1362114023, 1362114053, 1362114083,
1362114113, 1362114143, 1362114150, 1362114173, 1362114180, 1362114203,
1362114210, 1362114233, 1362114240, 1362114263, 1362114270, 1362114293,
1362114300, 1362114330, 1362114360, 1362114390, 1362114420, 1362114450,
1362114480, 1362114510, 1362114540, 1362114570, 1362114600, 1362114630,
1362114660, 1362114690, 1362114720, 1362114750, 1362114780, 1362114810,
1362114840, 1362114870, 1362114900, 1362114930, 1362114960, 1362114990,
1362115020, 1362115050, 1362115080, 1362115111, 1362115141, 1362115171,
1362115201, 1362115231, 1362115261, 1362115291, 1362115321), class = c("POSIXct",
"POSIXt"), tzone = ""), CPU = c(30L, 29L, 28L, 29L, 27L, 10L,
25L, 11L, 23L, 9L, 22L, 8L, 22L, 7L, 19L, 7L, 7L, …
Run Code Online (Sandbox Code Playgroud)