How to hide x-axis in lattice R

Deadly 提交于 2020-01-02 06:18:15

问题


How to hide x-axis (xlim?) in lattice xyplot?

Normally with plot that would be:

hist(rnorm(10,0,2), axes=F)

And also global solution would be great, since I have quite few plots. I'm using the gridExtra package:

grid.arrange(plot1,plot2,plot3, ncol=3)

This for instance allows to hide xlab, ylab, main.

pl = list(plot1,plot2,plot3)
do.call(grid.arrange, lapply(pl, update, xlab="", ylab="", main=""))

Sample data just in case:

Data <- data.frame(x=rnorm(10,2,2),y=rnorm(10,3,3),z=rexp(10,2))
plot1 <- xyplot(x~y, Data, xlab="name", ylab="name", main="title")
plot2 <- xyplot(z~y, Data, xlab="name", ylab="name", main="title")
plot3 <- xyplot(z~x, Data, xlab="name", ylab="name", main="title")

Hiding globally can be also shown on print() on the above or else all this helps.


回答1:


Try this

xyplot(1:10~1:10, scales=list(x=list(at=NULL)))

you should read the docs in ?xyplot




回答2:


You could also try

xyplot(1:10~1:10, scales=list(x=list(draw=FALSE)))



来源:https://stackoverflow.com/questions/18498349/how-to-hide-x-axis-in-lattice-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!