Re: [問題] 將 X 軸放到頂部 - ggplot

作者: celestialgod (天)   2014-03-08 18:20:57
Simple version for lattice:
library(lattice)
levelplot(value~X1+X2, Mat, main="", col.regions = heat.colors(18), xlab =
"x", ylab = "y", scales = list(x = list(alternating = 2)))
或是你要藍色系的話可以這樣做:
library(lattice)
levelplot(value~X1+X2, Mat, main="", col.regions = hcl(255, 80, seq(20, 90,
length = 18)), xlab = "x", ylab = "y", scales = list(x = list(alternating =
2)))
# another color
levelplot(value~X1+X2, Mat, main="", col.regions = hcl(130, 100, seq(40, 100,
length = 18)), xlab = "x", ylab = "y")
至於ggplot背後的格子,我就不太知道要怎樣畫上去比較漂亮了XD
畢竟我喜歡lattice的風格,沒有那麼愛ggplot~~
PS:
# 提供幾個色系供參考:
hcl(40, 80, seq(10, 90, length = 18)) # 橘色系
hcl(70, 80, seq(10, 90, length = 18)) # 黃色系
hcl(140, 80, seq(10, 90, length = 18)) # 綠色系
hcl(200, 80, seq(10, 90, length = 18)) # 藍綠色系
hcl(255, 60, seq(10, 90, length = 18)) # 藍色系
hcl(300, 80, seq(10, 90, length = 18)) # 紫色系
hcl(350, 80, seq(10, 90, length = 18)) # 紅色系
※ 引述《skylikewater (choc.)》之銘言:
: [問題敘述]:
: 小弟在畫格子狀的填塞矩陣 (geom_tile),
: 想把 X 軸放到上緣,變成本來是下面左圖變成右圖:
: 卻苦於找不到如何調控,想請各位指點...
: (我有努力翻閱ggplot2 doc跟搜尋網路,但感覺可能用錯搜尋關鍵字)
: ________
: | |
: | |
: | |
: | |
: |_________ |
: [程式範例]:
:
[關鍵字]:
lattice, levelplot, axis
作者: skylikewater (choc.)   2014-03-08 19:50:00
感謝你的協助! 我覺得用哪個套件真的是偏好XD

Links booklink

Contact Us: admin [ a t ] ucptt.com