Thank you both for your response.  As the names suggest, I am plotting the 
sales & price data for items over time to understand the how certain items may 
be more responsive than others to price changes.

Another way of displaying this information on the same chart as the one showing 
sales, would be to scale the price data between 0 and 1 (1 - 
current_price/max_price) and use a geom_tile (?) to display it. In terms of the 
axes, x axis would still be time, y axis would be constant (top of the chart) 
and fill would change based on the scaled price (i.e. discount).

Would it be possible to do this in ggplot2?

df <- melt(df, id=c('time', 'sid'))
ggplot(df, aes(time, value, colour=sid)) +
   geom_line(data = subset(df, variable=='sales')) +
   geom_point(data = subset(df, variable=='price')) +  <--- replace with 
geom_tile?
   facet_wrap(~sid + variable, ncol=1, scales='free_y') 

Thanks.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to