简体   繁体   English

R图:y轴标签出现问题

[英]R graph: Issue with y-axis label

I am very new to R. I am trying to learn. 我对R非常陌生。我正在尝试学习。 Due to some reason y-axis label is not showing up in the graph. 由于某些原因,y轴标签未显示在图形中。 Can anyone please help? 谁能帮忙吗?

R version 3.0.1: Script: R版本3.0.1:脚本:

dose <- c(20, 30, 40, 45, 60)
drugA <- c(16, 20, 27, 40, 60)
drugB <- c(15, 18, 25, 31, 40)
opar <- par(no.readonly=TRUE)
par(lwd=2, cex=1.5, font.lab=2)
plot(dose, drugA, type="b",
pch=15, lty=1, col="red", ylim=c(0, 60),
main="Drug A vs. Drug B",
xlab="Drug Dosage", ylab="Drug Response")

Above code shows the Drug Dosage but not showing Drug Response. 上面的代码显示了药物剂量,但未显示药物反应。

Thanks, Amit 谢谢阿米特

I tried running the code you provided and it worked perfectly in my installation of R. 我尝试运行您提供的代码,并且在我的R安装中效果很好。

Have you tried starting a new instance of R in which to run the code? 您是否尝试过启动要在其中运行代码的R的新实例? It could be that in working you changed an environment variable or display device variable that is preventing the label from showing up. 可能是在工作中您更改了阻止标签显示的环境变量或显示设备变量。

If a plain restart doesn't work, run R with these arguments: R --no-restore-data --no-init-file 如果纯重启不起作用,请使用以下参数运行R:R --no-restore-data --no-init-file

I ran the code and y-label came out just fine. 我运行了代码,然后y标签就很好了。 Try starting a new rsession with: 尝试使用以下命令开始新的会话:

R --no-restore-data --no-init-file

And plot again, could be something in your session which is causing trouble. 并再次绘图,可能是您的会话中有麻烦。

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

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