简体   繁体   English

删除R条件密度图中的轴标签

[英]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; 我无法从条件密度图(cdplot {graphics})中删除y轴标签,以便稍后水平旋转它们; axes = FALSE seems not to work. axes = FALSE似乎不起作用。 Any idea? 任何想法? Thanks! 谢谢!

Using the example data from R documentation: 使用R文档中的示例数据:

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) . 由于您没有向我们提供任何数据,因此我使用example(spineplot)提供的数据。

You can get rid of the axis labels by setting the appropriate parameter to NA : 您可以通过将适当的参数设置为NA来摆脱轴标签:

spineplot(fail~temperature,yaxlabels=NA)

But if you want to orient them horizontally, you normally set las=1 . 但是如果你想要水平定向它们,你通常设置las=1 Unfortunately, spineplot doesn't seem to pass this on, so you need to do a call to par first: 不幸的是, spineplot似乎没有通过这个,所以你需要先调用par

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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