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")
最佳答案
您可以将参数 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)))
关于r - 如何删除 R 中的 levelplot 刻度边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37306984/