changing range of color scale on levelplot

11,415

You can control the color break points in levelplot with the at argument. Try something like at=seq(min(psticorr), max(psticorr), length.out=120)

Share:
11,415
user1308144
Author by

user1308144

Updated on June 14, 2022

Comments

  • user1308144
    user1308144 about 2 years

    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.