问题描述
我有一个小问题。
用直线绘制直方图时,该直线不会立即显示。我必须将其绘制2次,然后切换回第一个图以查看实际线条。
hist(df$column,col = "lightgreen",main = "The BMI of the players",xlab = "BMI",ylab = "Amount of players",xlim=c(20,30),breaks = 20,freq=FALSE) # close hist
lines(density(df$column),col="blue",lwd=2)) # lines is a different command
因此,运行代码并查看:
第二次运行后,我得到了相同的图。但是,当我单击箭头查看以前的绘图时,我首先看到了想要的绘图(带有线条的绘图!)
有人知道我如何立即获得线的直方图
非常感谢您!
解决方法
如果在对Maybe
的调用中对char* p[2]= {"*","!myFile.dat"};
checkout_opts.paths.strings = p;
checkout_opts.paths.count = 2;
进行了调用,则lines
将作图,而hist
将在前一个图上添加一行,因为它们被同时调用。
尝试:
hist
将其直接显示在情节上
,赞
hist(df$column,col = "lightgreen",main = "The BMI of the players",xlab = "BMI",ylab = "Amount of players",xlim=c(20,30),breaks = 20,freq=FALSE) # close hist
lines(density(df$column),col="blue",lwd=2)) # lines is a different command