Does anyone know how to invoke the Zone FIll option in QCC for R

51 Views Asked by At

There is an option in QCC to fill the zones with colors. I have tried calling this option in my code but I don't think I understand how to call it or provide the arguments correctly and I am stuck, stuck, stuck. Picture below shows zones filled and not filled and the documented examples. Somewhere I'm missing either the proper syntax for invoking the fill or I'm missing something not so obvious to me.

I have tried the following variations from the documentation without success:

qcc.options("zones")$fill

I put the fill = TRUE in the code that plots my chart as the example shows. It doesn't throw an error but it doesn't do the fill.

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 )

enter image description here

1

There are 1 best solutions below

7
Dave2e On

I am not sure if qcc has that feature. One work around is to use the rect() function from the base graphics package.

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(0, cht$limits[2], length(cht$statistics)+1, cht$limits[1], col=grey(0.8, .3))

enter image description here