[BioC] Adjusting contrast in a heatmap

Simon Anders anders at embl.de
Thu Apr 15 10:29:17 CEST 2010


Hi Tony

>> I am generating this plot with image() function with a red-black-green
>> color
>> palette but the resulting image has a really poor contrast (because of
>> the
>> extreme expression values most of the image is dark)

A good trick from image processing is the gamma factor: If you plot some
numerical data x, just replace it with x^gamma, where gamma is a value
around 1. If you use a gamma < 1, e.g. gamma=.5, the contrast will be
stretched for the low values and compressed for the high ones, and vice
versa for gamma>1. Experiment with the gamma value until you get could
contrast at the part of the intensity scale that is of most interest for
you. Don't forget to asjust the colour key with the same gamma factor so
that your overall information is still correctly displayed.

Cheers
  Simon



More information about the Bioconductor mailing list