简体   繁体   中英

Remove axis labels in R conditional density plot

I could not manage to remove the y axis labels from a conditional density plot (cdplot{graphics}) in order to rotate them horizontally later; axes = FALSE seems not to work. Any idea? Thanks!

Using the example data from R documentation:

fail <- factor(c(2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1),
               levels = 1:2, labels = c("no", "yes"))
temperature <- c(53, 57, 58, 63, 66, 67, 67, 67, 68, 69, 70, 70, 70, 70, 72, 73, 75, 75, 76, 76, 78, 79, 81)
cdplot(fail ~ temperature, axes = FALSE)

Warning messages:
1: In density.default(x, bw = bw, n = n, ...) :
  non-matched further arguments are disregarded
2: In density.default(x[y %in% levels(y)[seq_len(i)]], bw = dx$bw,  :
  non-matched further arguments are disregarded

Since you are not giving us any data, I'm using the data provided in example(spineplot) .

You can get rid of the axis labels by setting the appropriate parameter to NA :

spineplot(fail~temperature,yaxlabels=NA)

But if you want to orient them horizontally, you normally set las=1 . Unfortunately, spineplot doesn't seem to pass this on, so you need to do a call to par first:

par(las=1)
spineplot(fail~temperature)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM