MatrixGradients.pl

MatrixGradients.pl is a program to generate color maps corresponding to values of a continuous variable in a matrix. It takes a matrix of values as input (txt format, tab-separated values) and generates a color map in the SVG (scalable vector graphics) format, which can be imported in most vectorial drawing software. Variables can be scaled along several color or gray scale gradients. Empty cells in the matrix are left blank in the color map.

Download

MatrixGradients.pl v.1.02 download (zip file)

Example output

A matrix with many near-zero values plotted along a green-yellow-orange-red gradient before and after transformation of the values. Transformation is useful if many values in the matrix are close to the maximum or minimum value and you want to exaggerate the color differences in that part of the values range. This is illustrated here for a matrix in which many values are close to zero, but with a few values that are considerably higher (up to 22.4). If plotted without transformation (left panel), the entire matrix is green, with just one red value, i.e. not very informative. If a log10 transformation is applied to the same matrix, a much clearer picture of what happens in the near-zero values emerges (right panel) simply because the color gradient is compressed near zero.



The figure below illustrates model selection using the Akaike Information Criterion. The background colors in the lower panel were generated with MatrixGradients.

Dependencies and links

Before running the uncompiled script, make sure you have these Perl modules installed. They can be obtained from CPAN.

  • Graphics::ColorUtils
  • SVG
  • Number::Format
  • Links:

  • cpan: comprehensive perl archive network
  • Citation

    If you find this software useful, please cite it in your work. I recommend citing it as follows:
    Verbruggen H. (2012) MatrixGradients version 1.02. http://www.phycoweb.net/software

    Notes and disclaimer

    MatrixGradients is in development and has not been tested extensively. It is quite plausible that incorrectly formatted input could lead to nonsensical output.

    MatrixGradients is open-source and distributed according to the GNU General Public License. The program is provided "as is" without warranty of any kind, either expressed or implied. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction. The author will not be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs).