2013-04-02 111 views
1

我是新的功能級別圖。 ICH讓X,Y,Z,我想以可視化的平畦方式如下:levelplot不顯示內容

> require(lattice) 



> head(z) 
    [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] 
[1,] 4.5 4.7 4.6 4.6 4.6 4.6 4.6 4.6 4.7 
[2,] 4.5 4.6 4.6 4.6 4.6 4.6 4.6 4.6 4.7 
[3,] 4.5 4.7 4.6 4.6 4.6 4.6 4.7 4.6 4.7 
[4,] 4.5 4.6 4.6 4.6 4.6 4.6 4.6 4.6 4.7 
[5,] 4.6 4.6 4.6 4.6 4.6 4.6 4.6 4.6 4.7 
[6,] 4.5 4.7 4.6 4.6 4.6 4.6 4.6 4.6 4.7 

> head(y) 
    [,1] 
[1,] 1 
[2,] 2 
[3,] 3 
[4,] 5 
[5,] 7 
[6,] 10 

> head(x) 
[1] "2013-01-03 04:30:00 GMT" "2013-01-03 04:45:00 GMT" "2013-01-03 05:00:00 GMT" 
[4] "2013-01-03 05:15:00 GMT" "2013-01-03 05:30:00 GMT" "2013-01-03 05:45:00 GMT" 

z表示水溫和y水深

我要繪製的數據下列方式:

> levelplot(z~x*y) 

軸和圖例正確繪製,但內容根本不繪製。誰能幫我??

最好的問候, 菲利普

回答

3

雖然我不知道爲什麼你試過沒有工作,似乎正確使用levelplot.array代替levelplot.formula廠(指定):

x <- as.POSIXct(x) #make sure x are POSIXct and not just characters 
levelplot(z, row.values=x, column.values=y, aspect="fill") 

enter image description here

+0

感謝您的幫助,它正在工作。 歡呼聲, Philip – user2115636