Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

any idea about drawing isoline (C#)?

Tags:

c#

graph

I have written a code to draw isolines on my colormap result pictures. I was thinking how I can improve it to have better presentation of information. Showing every isoline value will be interesting. Same as this picture :

picture

Do you have any suggestions about applying in my code? Or do you think it is better to have isolines with different colors and have a key part for each isoline color?

This is my code that works perfectly.

double[] isoLineValueArray = new double[this.isoLineNumber];
double dVal = (valueMax - valueMin) / (this.isoLineNumber + 1);
double currentVal = valueMin;
for (int i = 0; i < this.isoLineNumber; i++)
{
    currentVal += dVal;
    isoLineValueArray[i] = currentVal;
}
for (int v = 0; v < isoLineValueArray.Length; v++)
{
    // cycle though all nodes 
    for (int i = 0; i < nx-1 ; i++)
    {
        for (int j = 0; j < ny-1 ; j++)
        {
            dxSum4 = dxSum4 + nx;
            dySum4 = dySum4 + ny;

            // nodal position
            centerPoint.X = (dxSum4 - startXPos) / (endXPos - startXPos) *
                (double)(xAxisPosition[this.nTicks - 1] - xAxisPosition[0]) +
                (double)xAxisPosition[0];
            centerPoint.Y = -theSpace.TheCells[i, j, 0].YCellDimension +
                (dySum4 - startYPos) / (endYPos - startYPos) *
                (double)(yAxisPosition[this.nTicks - 1] - yAxisPosition[0]) +
                (double)yAxisPosition[0];

            // reset 
            dxSum4 = 0.0;
            dySum4 = 0.0;

            // add to line list
            lineList.AddRange(myLineGenerator.DetermineLines(...));
        }
    }
}
like image 481
Mehdi Avatar asked Dec 02 '25 07:12

Mehdi


1 Answers

Instead of having isolines with different colors, you could have a key part with the background colors and a number corresponding to the locations of the isolines and keep the single colored isolines. Too many colors could be disturbing.

Something like this, where each number and horizontal line corresponds to a isoline position:

suggested look of isolines

like image 158
Olivier Jacot-Descombes Avatar answered Dec 03 '25 21:12

Olivier Jacot-Descombes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!