I'd like to create plot global temperature anomalies (recorded and projected) from 1950-2114 on a log-10 timescale as colors on a yellow-red color gradient.
Based on answers to this question, I've been able to create a color bar that is more or less what I'm aiming for, except that the time-scale is linear, not logarithmic.
This is the code I used, with a dummy vector dataset.
temps<-rnorm(165)
scaled_temps <- (temps - min(temps)) / diff(range(temps))
FUN <- colorRamp(c("yellow","red"))
cols <- FUN(scaled_temps)
rgb(cols, maxColorValue=256)
my.colors = colorRampPalette(c(rgb(cols, maxColorValue=256)))
z=matrix(1:165,nrow=165)
y=1
x=seq(1950, 2114,len=165)
image(x,y,z,col=my.colors(165),axes=FALSE,xlab="",ylab="")
axis(1)
Any thoughts on how to plot this on a log-scale? Using a matrix
and image
may not be the way to go, given that the color for each year won't have a fixed width.
Any input would be appreciated.