r - 如何删除 R 中的 levelplot 刻度边框?

标签 r border lattice levelplot

levelplot 函数在方框的所有边上都带有刻度线来渲染热图。我想保留 x 和 y 轴上的刻度线,但删除顶部和右侧的刻度线。

如何移除框周围的右边框和上边框?

#fake data
data(mtcars)
cars.matrix <- as.matrix(mtcars[c(2:8)])
cars.corr <- cor(cars.matrix)
 
library('lattice')
levelplot(cars.corr, xlab="car stuff",ylab="Car Stuff", main="car stuff")
 

Car levelplot image

最佳答案

您可以将参数 scales 传递给 levelplot,它在 ?xyplot 中使用,您可以在其中找到说明:

scales: Generally a list determining how the x- and y-axes (tick marks and labels) are drawn.

  • tck Usually a numeric scalar controlling the length of tick marks. Can also be a vector of length 2, to control the length of left/bottom and right/top tick marks separately.
#fake data
data(mtcars)
cars.matrix <- as.matrix(mtcars[c(2:8)])
cars.corr <- cor(cars.matrix)

library('lattice')
levelplot(cars.corr, xlab="car stuff",ylab="Car Stuff", main="car stuff",
          scales = list(tck = c(1,0)))

enter image description here

关于r - 如何删除 R 中的 levelplot 刻度边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37306984/

相关文章:

r - R 中的发生率置信区间

r - knitr:如何从 block 内部获取和覆盖 block 选项

r - 是否有任何命令可以保留具有特定格式时间字符串的子集行?

mfc - 我可以使用 MFC 更改窗口边框的粗细吗?

r - 如何更改点阵图中 Key 中列的宽度?

r - 尝试删除第一次出现的字符 |

html - 如何在 `border-*` 属性中使用百分比?

CSS - 当我调整浏览器大小时,我的边框底部也会调整大小

r - 多面板点阵图的不同 strip 高度

r - 如何设置spplot的默认主题?