Example: Heatmap from Color array

A 5 by 10 array of Color objects is created by linearly interpolating red along the x-axis, blue along the y-axis and mixing in a random amount of green. The data range is set to [0,10] by [0,1].
using Imsl.Chart2D;
using System;
using System.Windows.Forms;

public class HeatmapEx1 : FrameChart 
{
    public HeatmapEx1() 
    {
        Chart chart = this.Chart;

        AxisXY axis = new AxisXY(chart);
        
        double xmin = 0.0;
        double xmax = 10.0;
        double ymin = 0.0;
        double ymax = 1.0;
        
        int nxRed = 5;
        int nyBlue = 10;
        
        System.Random random = new System.Random((System.Int32) 123457L);
        System.Drawing.Color[,] color = new System.Drawing.Color[nxRed,nyBlue];

        int z=0;
        int []d=new int[50];
        d[0]=34;
        d[1]=212;
        d[2]=122;
        d[3]=86;
        d[4]=165;
        d[5]=62;
        d[6]=195;
        d[7]=161;
        d[8]=103;
        d[9]=155;
        d[10]=104;
        d[11]=163;
        d[12]=217;
        d[13]=252;
        d[14]=13;
        d[15]=97;
        d[16]=104;
        d[17]=74;
        d[18]=65;
        d[19]=248;
        d[20]=189;
        d[21]=195;
        d[22]=105;
        d[23]=191;
        d[24]=237;
        d[25]=28;
        d[26]=234;
        d[27]=67;
        d[28]=172;
        d[29]=146;
        d[30]=129;
        d[31]=2;
        d[32]=228;
        d[33]=162;
        d[34]=235;
        d[35]=177;
        d[36]=109;
        d[37]=251;
        d[38]=215;
        d[39]=243;
        d[40]=106;
        d[41]=154;
        d[42]=22;
        d[43]=65;
        d[44]=101;
        d[45]=192;
        d[46]=103;
        d[47]=28;
        d[48]=32;
        d[49]=143;

        for (int i = 0; i < nxRed; i++)
        {
            for (int j = 0; j < nyBlue; j++)
            {
                int r = (int) (255.0 * i / nxRed);
                //    
                int g =d[z];
                z++;
                
                int b = (int) (255.0 * j / nyBlue);
                color[i,j] = System.Drawing.Color.FromArgb(r, g, b);
            }
        }
        Heatmap heatmap = new Heatmap(axis, xmin, xmax, ymin, ymax, color);
        axis.AxisX.AxisTitle.SetTitle("Red");
        axis.AxisY.AxisTitle.SetTitle("Blue");
    }

    public static void Main(string[] argv) 
    {
        System.Windows.Forms.Application.Run(new HeatmapEx1());
    }
}

Output

Link to C# source.