lib(reshape2)
lib(ggplot2)
dev.off()
.us()


dev_gpu   <- {dev.new(); dev.cur();}
dev_units <- {dev.new(); dev.cur();}


Spotify_GPU_Check <- DT.MonthlyAnalytics[store == 286 & date >= '2013-09-01']
Spotify_GPU_Check[, gpu_using_scaled := scaleunif(GPU_using)]
Spotify_GPU_Check[, units_scaled := scaleunif(units)]

dev.set(dev_gpu);   ggplot(data=Spotify_GPU_Check, aes(x=date, y=gpu_using_scaled, color=label_sc_group)) + geom_line() + geom_point() + facet_grid(~transac_typeid)
dev.set(dev_units); ggplot(data=Spotify_GPU_Check, aes(x=date, y=units_scaled, color=label_sc_group)) + geom_line() + geom_point() + facet_grid(~transac_typeid)
#ß + scale_y_log10()


----
A.test <- DT.storeavg2[store==1 & transac_typeid==4 &label_sc_group=="Allegro"]
A.melted <- melt(data=A.test, id=c("date", "store", "transac_typeid", "label_sc_group"), measure =c("GPU", "GPU_Est_Fore", "GPU_Est_MA", "GPU_blended"))

setkey(A.melted, transac_typeid, label_sc_group, store, date)

i <- 2
trans.using <- unique(A.melted$transac_typeid) [[i]]
scgroup.using <- unique(A.melted$label_sc_group) [[j]]
ggplot(data=A.melted[.(trans.using, scgroup.using)], aes(x=date, y=value, color=variable)) + geom_point() + geom_line(alpha=.3) + ggtitle(paste(trans.using, "-", scgroup.using))
