Skip to content

Instantly share code, notes, and snippets.

@JoesDataDiner
Last active December 14, 2015 03:19
Show Gist options
  • Save JoesDataDiner/5019895 to your computer and use it in GitHub Desktop.
Save JoesDataDiner/5019895 to your computer and use it in GitHub Desktop.
The Financial Crisis on Tape Part I - Graph - 1st attempt
library(ggplot2)
library(scales)
library(RColorBrewer)
#this is a slightly bespoke scale - basically I wanted a blue to red scale
#that gave extra variation over the interesting 0.6-1.0 range.
mycolvec_1 = c(rev(brewer.pal(8,"Blues")),rep("white",3),brewer.pal(8,"YlOrRd"))
ggplot(rolling.correlmatrix, aes(x = Var1, y = Var2, fill = Correl)) +
geom_tile() +
scale_fill_gradientn(colours = mycolvec_1
,limits = c(-1,1))+
facet_grid(quarter~year)+theme_bw()+
theme(panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x=element_text(angle=90))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment