2015-08-27 46 views
2

我想只在y軸上有等級圖邊距。默認情況下,邊距顯示在x軸和y軸上。這裏有一個例子:等級圖中的一側邊緣

library (raster) 
library(rasterVis) 

f <- system.file("external/test.grd", package="raster") 
r <- raster(f) 
levelplot(r, margin=T) 

enter image description here

回答

2

我想你可能需要去用不同的繪圖解決方案,創建了兩個獨立的地塊,並用手安排,或創建rasterVis::levelplot()功能的修改版本。

作爲一個hacky的替代品,你可以試試這個,儘管它確實有一些工件,比如爲x邊緣面板留下空間,並且由於空數據範圍而拋出警告,但它完成了你想要的於:

levelplot(r, margin=T, scales.margin=list(x=c(0,0), y=NULL)) 

enter image description here

1

我將在rasterVis包儘快添加此功能成爲可能。同時,你可以使用或福雷斯特提出的解決方案這個替代:

p <- levelplot(r) 
p$legend$top <- NULL 
p 

levelplot with only one margin

+0

,你會給我如何能做到這一點在新版本中,當你添加的功能更新? –

+0

@DNM它已經在[CRAN]提供的版本中實現([commit](https://github.com/oscarperpinan/rastervis/commit/c976cc333a4f9576a146e1dc2cb590136ee6b969))(https://cran.r-project.org/網絡/包/ rasterVis /) –