0

enter image description here

Is there any way to change those two labels to "Old" and "New"?

Here is sample code:

dat <- data.frame(id = c(1:10), num = sample(1:10), den = c(11:20))
qcc::qcc(data = dat$num[1:5], sizes = dat$den[1:5],
         newdata = dat$num[6:10], newsizes = dat$den[6:10],
         type = "u", plot = T, data.name = "Old", newdata.name = "New")
Y. Z.
  • 369
  • 2
  • 16

1 Answers1

0

I don't think there is a straight forward way to change those texts since it is harcoded with mtext in the code.

mtext returns NULL value so you there is nothing that you can change there either.

One option would be to copy the entire source code of qcc function and create your own version of the function. Change those lines with text of your choice or make it variable and pass it as an argument to the function which you can change on the fly.

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • Thanks a lot for the suggestions. I have tried it but it shows an error "Error in qccRules(object) : could not find function "qccRules"". I have changed that part to qcc::qccRules(object) and still not working. – Y. Z. Mar 08 '21 at 05:01
  • You can copy the code from here https://github.com/luca-scr/qcc/blob/master/R/rules.R I also realised that you need to change the function `plot.qcc` and call that changed function in the new `qcc` function at the last line. – Ronak Shah Mar 08 '21 at 06:02