增加R中的线条粗细
Increasing the line thickness in R
我正在尝试制作一个包含 2 个变量的密度图,但我需要线条更粗。我用过这个命令:
>print(plot(density(x,na.rm = T),col="blue",lwd=3,main="Text",cex.main=1.2))
>lines(density(y,na.rm = T),col="purple",lwd=3)
虽然它确实加粗了线,但在它显示的命令下方:NULL
我究竟做错了什么?提前致谢。
不需要print
。只是做:
# Sample data
set.seed(2017);
x <- rnorm(100, 2);
y <- rnorm(100, 2, 3);
plot(density(x, na.rm = T), col = "blue", lwd = 3, main = "Text", cex.main = 1.2);
lines(density(y, na.rm = T), col = "purple", lwd = 3)
我正在尝试制作一个包含 2 个变量的密度图,但我需要线条更粗。我用过这个命令:
>print(plot(density(x,na.rm = T),col="blue",lwd=3,main="Text",cex.main=1.2))
>lines(density(y,na.rm = T),col="purple",lwd=3)
虽然它确实加粗了线,但在它显示的命令下方:NULL 我究竟做错了什么?提前致谢。
不需要print
。只是做:
# Sample data
set.seed(2017);
x <- rnorm(100, 2);
y <- rnorm(100, 2, 3);
plot(density(x, na.rm = T), col = "blue", lwd = 3, main = "Text", cex.main = 1.2);
lines(density(y, na.rm = T), col = "purple", lwd = 3)