在qicharts上标记x轴

时间:2017-08-25 14:38:05

标签: charts controls axis labeling

我制作了下面描述的个人控制图。数据集有一个名为date的变量,格式为R格式YMD。我想让x轴显示每个YMD,并带有标识特定YMD的标签。

以下是我目前生成个人控制图的代码:qic(数据$记录,图表= c(" i"),x.format ="%Y-%m-% d"。)

Individuals Control Chart

谢谢!

1 个答案:

答案 0 :(得分:0)

您需要指定x和xlab参数。以下是使用更新的qicharts2包的示例:

library(qicharts2)

# Build data frame for example
df <- data.frame(x = rep(1:24, 4),
             ReportMonth = (rep(seq(as.Date('2014-1-1'),
                                    length.out = 24,
                                    by = 'month'),
                                4)),
             num = rbinom(4 * 24, 100, 0.5),
             denom = round(runif(4 * 24, 90, 110)),
             grp1 = rep(c('g', 'h'), each = 48),
             grp2 = rep(c('A', 'B'), each = 24))

#now plot an 'i' chart :
  qic(
  x= ReportMonth,
  y= num,
  # n= denom,
  data=df, 
  chart= "i",
  x.format="%Y-%m-%d",
  x.angle = 90,
  y.expand = 40, # where to start y axis from
  xlab = "Month",
  ylab= "Value")

输出:

i chart