小编mad*_*ann的帖子

R levelplot colorkey标签和颜色范围

我试图从格子包中制作一个水平图(也是显示轮廓线).我有几个问题(如下所述).

MyData:https: //www.dropbox.com/s/ht55g0qlkiou2x2/growth.matrix.stackoverflow.xlsx

require(lattice)      
require(latticeExtra) 
require(xlsx)   

#matrix to be plotted
growth.matrix<-as.matrix(read.xlsx("C:/Users/eckmannm/Dropbox/growth.matrix.stackoverflow.xlsx",sheetName="p4.pct",colIndex=2:8,startRow=3,endRow=15,header=FALSE))

#column values
TempRange<-as.numeric(c(0, 2, 4, 6, 8, 10, 12))
#row values
MeanTemp<-as.numeric(c(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18))
#x and y axis labels
x.range<-as.numeric(c(6, 8, 10, 12, 14, 16, 18))

#color ramp
col.l <- colorRampPalette(c('red', 'orange', 'yellow', 'green', 'cyan', 'blue'))

colorplot<-
   levelplot(
   growth.matrix, 
   row.values=(MeanTemp),
   column.values=(TempRange),
   col.regions=col.l,
   at=seq(from=0,to=1.01,length=100),   
   lattice.options=list(key=list(cex=4)),
   panel = panel.2dsmoother,
   scales=list((x=list(labels=MeanTemp)), y=list(labels=TempRange)), 
   colorkey=list(at=as.numeric(factor(c(seq(from=0, to=1, by=.20)))),
               labels=as.character(c( "0", "20%", "40%", "60%", …
Run Code Online (Sandbox Code Playgroud)

r lattice removing-whitespace levelplot

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

lattice ×1

levelplot ×1

r ×1

removing-whitespace ×1