您可能希望将其绘制为与预测值的累积偏差。这是否有意义取决于计费/分析期是什么:如果团队必须在每个季度保持低于某个限制,这将使他们能够看到他们是否正在实现该目标。但是,如果他们的帐户余额每周都重置为零,那么这种图表的用处就会降低。

或者,超出曲线可能有用。这会按大小对每个用户的每周偏差进行排序。它允许评估每个用户有多少时间高于或低于他们的目标。在下面的图表中,您可以看到,尽管除了user5超过 50% 的时间之外,所有用户都低于他们的限制,但整个组几乎有 60% 的时间超过了他们的限制。

对于显示数据的完全不同的方式,瀑布图可能会让您感兴趣。它显示了每周值的细分,但有五个变量,它已经变得非常混乱:

这是图表的 R 代码。
累积偏差
library(ggplot2)
data <- cumsum(
data.frame(
user1 = c(-0.075, -0.09, 0.32, -0.242, -0.368, -0.401, -0.73, -0.367, -0.294, -0.043, 1.296, 0.075, -0.373),
user2 = c(-0.009, -0.013, -0.01, -0.008, -0.008, -0.01, -0.005, -0.02, 0.287, 0.345, -0.104, -0.324, 0.144),
user3 = c(-0.197, -0.271, -0.153, -0.621, -0.549, -0.09, 1.745, 0.436, -0.271, 0.093, 0.085, 0.211, 0.331),
user4 = c(-0.005, -0.005, -0.006, -0.006, -0.006, -0.005, -0.006, -0.086, -0.171, -0.15, -0.175, -0.067, 0.078),
user5 = c(-0.223, -0.048, -0.129, 0.14, -0.535, -0.29, 0.51, 0.801, 0.521, 0.482, -0.105, 5.082, 5.516),
group = c(-0.509, -0.427, 0.022, -0.737, -1.466, -0.796, 1.514, 0.764, 0.072, 0.727, 0.997, 4.977, 5.696)
)
)
data$week=c(1:13)
molten <- melt(data,id.vars="week")
p <- ggplot(molten, aes(x=week, y=value, colour=variable)) +
geom_line(aes(group=variable)) +
scale_colour_hue(h=c(100,250)) +
geom_line(aes(y=molten$value[molten$variable=="group"]), colour="orange", size=1.5) +
theme_bw() + opts(legend.position = "none") +
geom_text(data=molten[molten$week==13,], aes(label=variable), colour="black", hjust=-0.2, size=4) +
xlim(0,13.9) + xlab("Week") + ylab("Cumulated Deviation")
print(p)
超越曲线
library(ggplot2)
data <- data.frame(
user1 = c(-0.075, -0.09, 0.32, -0.242, -0.368, -0.401, -0.73, -0.367, -0.294, -0.043, 1.296, 0.075, -0.373),
user2 = c(-0.009, -0.013, -0.01, -0.008, -0.008, -0.01, -0.005, -0.02, 0.287, 0.345, -0.104, -0.324, 0.144),
user3 = c(-0.197, -0.271, -0.153, -0.621, -0.549, -0.09, 1.745, 0.436, -0.271, 0.093, 0.085, 0.211, 0.331),
user4 = c(-0.005, -0.005, -0.006, -0.006, -0.006, -0.005, -0.006, -0.086, -0.171, -0.15, -0.175, -0.067, 0.078),
user5 = c(-0.223, -0.048, -0.129, 0.14, -0.535, -0.29, 0.51, 0.801, 0.521, 0.482, -0.105, 5.082, 5.516),
group = c(-0.509, -0.427, 0.022, -0.737, -1.466, -0.796, 1.514, 0.764, 0.072, 0.727, 0.997, 4.977, 5.696)
)
data_sorted <- data.frame(apply(data,2,sort,decreasing=T))
data_sorted$exceedance_prob=c(0:12)/12
molten <- melt(data_sorted,id.vars="exceedance_prob")
p <- ggplot(molten, aes(x=exceedance_prob, y=value, colour=variable)) +
geom_line(aes(group=variable)) +
scale_colour_hue(h=c(100,250)) +
geom_line(aes(y=molten$value[molten$variable=="group"]), colour="orange", size=1.5) +
theme_bw() + opts(legend.position = "none") +
geom_text(data=molten[molten$exceedance_prob==0,], aes(label=variable), colour="black", hjust=1.2, size=4) +
xlim(-0.1,1) + xlab("Exceedance Probability") + ylab("Deviation")
print(p)
超越曲线
library(ggplot2)
data <- data.frame(
user1 = c(-0.075, -0.09, 0.32, -0.242, -0.368, -0.401, -0.73, -0.367, -0.294, -0.043, 1.296, 0.075, -0.373),
user2 = c(-0.009, -0.013, -0.01, -0.008, -0.008, -0.01, -0.005, -0.02, 0.287, 0.345, -0.104, -0.324, 0.144),
user3 = c(-0.197, -0.271, -0.153, -0.621, -0.549, -0.09, 1.745, 0.436, -0.271, 0.093, 0.085, 0.211, 0.331),
user4 = c(-0.005, -0.005, -0.006, -0.006, -0.006, -0.005, -0.006, -0.086, -0.171, -0.15, -0.175, -0.067, 0.078),
user5 = c(-0.223, -0.048, -0.129, 0.14, -0.535, -0.29, 0.51, 0.801, 0.521, 0.482, -0.105, 5.082, 5.516),
group = c(-0.509, -0.427, 0.022, -0.737, -1.466, -0.796, 1.514, 0.764, 0.072, 0.727, 0.997, 4.977, 5.696)
)
originaldata <- data
data <- data[,1:5]
lower<-as.data.frame(t(apply(data,1,"cumsum")))
data$week=c(1:13)
lower$week=c(1:13)
molten <- melt(data,id.vars="week")
moltenlower <- melt(lower,id.vars="week")
molten$lower <- moltenlower$value
p <- ggplot(molten, aes(x=week, y=value, fill=variable)) +
geom_rect(aes(
xmin=week+as.numeric(variable)/6-0.5,
xmax=week+as.numeric(variable)/6-0.35,
ymin=lower,
ymax=lower-value,
group=variable),
colour="black") +
scale_fill_brewer()+
theme_bw() +
xlim(0.5,13.5) + xlab("Week") + ylab("Cumulated Deviation") + ylim(-2,2)
print(p)