Displaying 1 result from an estimated 1 matches for "tp1469011p1469030".
2010 Feb 04
2
ggplot2 / time series with different scales
I am trying to plot this dataset using ggplot2:
df <- data.frame(
sid = c(rep('11',30),rep('22',30)),
time = rep(ISOdate(year = 2010, month = 1, day = 1:30),2),
sales = c(rnorm(30, 1000, 20),rnorm(30, 900, 10)),
price = c(rnorm(30, 2, 0.5),rnorm(30, 3,0.5))
)
Plotting just the sales can be done easily:
ggplot(data=df, aes(x=time, y=sales, group=sid, color=sid)) +