« Thoughts on the SF Bay Data Mining Camp | Main | RPE: the R Productivity Environment for Windows »

November 03, 2009

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a010534b1db25970b0120a6402781970b

Listed below are links to weblogs that reference Charting time series as calendar heat maps in R:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Nice thanks! It's amazing how giving the R community is. Thanks for the blog.

Here's a quick rendition in ggplot2:

stock.data <- transform(stock.data,
  week = as.POSIXlt(Date)$yday %/% 7 + 1,
  wday = as.POSIXlt(Date)$wday,
  year = as.POSIXlt(Date)$year + 1900)

library(ggplot2)
ggplot(stock.data, aes(week, wday, fill = Adj.Close)) +
geom_tile(colour = "white") +
scale_fill_gradientn(colours = c("#D61818","#FFAE63","#FFFFBD","#B5E384")) +
facet_wrap(~ year, ncol = 1)

But maybe a better display of the same data is :

qplot(week, Adj.Close, data = stock.data, colour = factor(wday), geom = "line") + 
  facet_wrap(~ year, ncol = 1)

Your package allows such concise definition of graphics Hadley. This really demonstrates the power of your paradigm for ggplot yet again.

Neat! I just used it to chart my iPhone app sales over time:
http://blog.planetaryscale.com/2009/11/04/iphone-app-sales-heatmap/

Would be interesting to see the % daily change (instead of closing price) in this format.

A bug in merge used in original sourceode shifts data one day. Instead use this:

# Merge moves data by one day, avoid
caldat <- data.frame(date.seq = seq(min.date, max.date, by="days"), value = NA)
dates <- as.Date(dates)
caldat$value[match(dates, caldat$date.seq)] <- values

Very nice. Even better - hook this into a web application, make the heat map a clickable image map taking you to data for that date.

Thanks for showcasing this great tool. I outlined it in a blog on machine learning trading methods, and made a small modification to evaluate %daily changes, instead of price values.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid

R links

Recommended Sites

Search Revolutions Blog