Skip to Content

changing range of color scale on levelplot

I want to do a little tweeking to an image. My command to generate a simple heatmap of correlations is as follows:

psticorr <- cor(psti)
rgb.palette <- colorRampPalette(c("blue", "yellow"), space = "lab")
levelplot(psticorr, col.regions=rgb.palette(120), scales=list(x=list(cex=.3), y=list(cex=.3)), main="PstI: Correlations of loci coverage", xlab="Samples", ylab="Samples" )

I get what I need but I would really like if I could set the range of the color scale e.g from 0 to 1, at the moment it starts at my lowest correlation (r) value.