graph - Plotting a smoothed line against lots of "noisy looking" original data in R -
i'm trying convey general impression of noisy performance figures, think want plot loess-smoothed curve of original data. should explicitly point out throwing away of data's precision totally fine; merely want point out figures have form (mostly) repeating pattern.
the reason want show can prove i've considered data whole, , examining e.g. single day in more detail not lazy sounds.
i have tried run smooth.spline , loess against data, think fails because of way i'm calling ggplot. believe have strange incantation of ggplot , ggsave because code inside function, , calls ggplot inside function appear go wrong because of scoping behaviour (not looked @ closely; don't understand r's scoping).
here's example code shows i'm trying:
library("ggplot2") library("reshape2") iops_october <- read.csv("iops_oct.csv", header=true) iops_october <- subset(iops_october, select=c("read_iops", "write_iops", "total_iops", "time")) iops_october$time <- as.posixct(iops_october$time, format="%y-%m-%d %h:%m:%s") molten_iops <- melt(iops_october, id.vars="time") #plot = ggplot(data=molten_iops, aes(x=time, y=value, color=variable)) + geom_line() + lines(smooth.spline(iops$time, iops$wrie_iops)) plot = ggplot(data=molten_iops, aes(x=time, y=value, color=variable)) + geom_line() ggsave("october.svg", plot=plot, width=64, height=24, limitsize=false)
as needs bit of data, can find ~100kbyte file here
i suppose ultimate aim average out figures based on time (throwing away date component), think can creating additional as.time column, , averaging using "time" group.
Comments
Post a Comment