I'm using the geom_tile
to draw an imagemap and want to clear out the zero level for clarity.
#dummy data
set.seed(1)
tdata <- data.frame(cat1=rep(letters[1:3],4),cat2=sort(rep(LETTERS[1:4],3)),val=rpois(12,1.5))
tdata$val<-tdata$val/max(tdata$val)
I have found 2 ways to do this but both have their drawbacks:
1)
qplot(cat1,cat2,data=tdata,geom="tile",fill=val) + scale_fill_continuous(limits=c(.Machine$double.eps,1))
This has the drawback that the min value colour isn't printed in the scale.
2)
qplot(cat1,cat2,data=tdata,geom="tile",fill=val,alpha=ifelse(val,1,0))
This has the drawback that the alpha scale is plotted too. Wrapping the alpha argument in an I()
causes it to fail.
Is there a way to do this without the drawbacks?