简体   繁体   English

条形图中阴影线的宽度

[英]Width of shading lines in barplot

I created a barplot with the following script in R:我在 R 中使用以下脚本创建了一个条形图:

bars <- c(229, 158)
shading.lines <- c(83, 83)
years <- c("1985-89", "2017")
cols1 <- c("indianred4","green4")
cols2 <- c("green4","indianred4")
barplot(bars,names.arg=years,col=cols1)
barplot(shading.lines,names.arg=NA,col=cols2,density=11,add=T)

在此处输入图片说明

Is there a way to adjust the width of the shading lines?有没有办法调整阴影线的宽度? I`d like to have them thicker in order to get the same appeareance of the shaded part in 1985-89 and 2017.我想让它们更厚,以便在 1985-89 和 2017 年获得与阴影部分相同的外观。

You can adjust the width of shading using par(lwd=...) :您可以使用par(lwd=...)调整阴影的宽度:

bars <- c(229, 158)
shading.lines <- c(83, 83)
years <- c("1985-89", "2017")
cols1 <- c("indianred4","green4")
cols2 <- c("green4","indianred4")
barplot(bars,names.arg=years,col=cols1)
# Set width of shading
par(lwd=5)
barplot(shading.lines,names.arg=NA,col=cols2,density=11,add=T)
# Set width of shading to the default value
par(lwd=1)

在此处输入图片说明

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

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