有谁知道如何在R的QCC中调用Zone FIll选项

whhtz7ly  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(74)

QCC中有一个选项,可以使用颜色填充区域。我试着在代码中调用这个选项,但我不知道如何正确地调用它或提供参数,我卡住了,卡住了,卡住了。下图显示了填充和未填充的区域以及记录的示例。在某些地方,我错过了调用fill的正确语法,或者我错过了一些对我来说不太明显的东西。
我尝试了以下文档的变体,但没有成功:

qcc.options("zones")$fill

我把fill = TRUE放在绘制图表的代码中,如示例所示。它不会抛出错误,但不会执行填充操作。

cht <- qcc(v, type="xbar.one", plot = "FALSE" , labels = xticks )
plot(cht, restore.par =FALSE, fill= TRUE, title = "", xlab = "", ylab = "moisture %", axes.las = 2, add.stat = FALSE )

xyhw6mcr

xyhw6mcr1#

我不确定QCC是否有这个功能。一种解决方法是使用基本图形包中的rect()函数。

library(qcc)

#generate some random data
v <- rnorm(30, 74, .5)

#create the chart object
cht <- qcc(v, type="xbar.one", plot = "FALSE"  )

#plot
plot(cht, restore.par =FALSE, fill= TRUE, title = "", xlab = "", ylab = "moisture %", axes.las = 2, add.stat = FALSE )

#now add the box as an extra feature.  Use the grey function to set the color.
#access the limits stored in the cht object.
rect(1, cht$limits[2], length(cht$statistics), cht$limits[1], col=grey(0.8, .3))

相关问题