简体   繁体   中英

Modify axes in control chart RStudio

I would like to ask a help in modify axes in control chart in RStudio, by qcc package.

Generated a controlchart type EWMA, in the axes x, appear group, sequencially (that represents each observations), but I need insert an information about year (divide group into sequence of year). I tried using the command (axes), but doesn't work.

Which command or function it is possible to modify to achieve this?

Thank you very for help!

需要更改轴 x 中的组序列以显示观察年份

Yours faithfully

Guilherme

The ewma function in qcc accepts a labels parameter: a character vector of labels for each group. You could, for instance, do something like:

library(qcc)

data(pistonrings)
attach(pistonrings)
diameter <- qcc.groups(diameter, sample)

label_x <- as.character(seq.Date(from = as.Date("2020/01/01"), length.out = 25, by = "day"))

q2 <-
   ewma(
    diameter[1:25, ],
    center = 0,
    lambda = 0.4,
    std.dev = 0.57,
    nsigmas = 3,
    add.stats = FALSE,
    labels = label_x
  ) 

And end up with a properly labelled x-axis in your EWMA plot: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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