本文介绍了在R中编辑我的直方图的美感的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了此代码
RendBio= RtBio
m<-mean(RtBio)
std<-sqrt(var(RtBio))
hist(RendBio, density=20, prob=TRUE,
xlab="Rendimientos Bio Pappel", ylim=c(0, 20),
main="normal curve over histogram", col="brown1")
curve(dnorm(x, mean=m, sd=std),
col="darkgoldenrod1", lwd=2, add=TRUE, yaxt="n")
当我运行代码时,直方图中有线条,但是我希望它充满纯色。有办法吗?
When I run the code there are lines in my histogram but I'd like it to be filled with e solid color. Is there a way to do this?
推荐答案
如果要透明,则需要对rgb使用相同值的参数为 col2rgb( brown1)
,但带有alpha参数:
If you want transparency then you need to use an argument to rgb with the same values as col2rgb("brown1")
but with an alpha argument:
col2rgb("brown1")
[,1]
red 255
green 64
blue 64
# Since you want to have transparency of 20% use maxColorValue=1
rgb( 1,.25,.25, .2)
[1] "#FF404033"
尝试:
hist(RendBio, prob=TRUE,
xlab="Rendimientos Bio Pappel", ylim=c(0, 20),
main="normal curve over histogram", col=rgb( 1,.25,.25, .2) )
这篇关于在R中编辑我的直方图的美感的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!