Relatively new to site and r so please forgive any protocols I may not adhere to.
I am producing a plot with xyplot. My code
library(lattice)
height <- c(1,3,5)
mass <- c(10, 12, 14)
d <- data.frame (height,mass)
xyplot(height ~ mass, type = 'a', scales = list(alternating = 1, tck = c(1,0)))
and I get this
My problem is that I cannot remove the labels from the x-axis so only the y-axis ticks are labelled. This is so I can stack a number of plots with data.arrange. I have looked here and on other places online and found some answers but I clearly do not understand the code because I still cannot do it. I have tried removing the axes and rebuilding with "scales" to no success.
Can someone please assist me with this?
Regards Aaron
Inside the scales
argument you can add a list for the attributes of the x-axis and set labels=NULL
. For additional options, see the scales
section in the help for xyplot
. I've also removed the x-axis title since you probably won't want that repeated for each graph either:
xyplot(height ~ mass, type ='a', xlab="",
scales=list(alternating=1, tck=c(1,0), x=list(labels=NULL)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.