Follow

Can I load a CLR file for a contour map via Surfer automation?

Yes, you can load a CLR file for a contour map in Surfer via automation. All the CLR files for all the presets are saved to the installation file under the ColorScales folder. So you could use

 

'Load a CLR file for the contour layer 
ContourLayer.FillForegroundColorMap.LoadFile(SurferApp.Path+"\ColorScales\Rainbow.clr")
'Applies the above fill settings to the layer
ContourLayer.ApplyFillToLevels(1, 1, 0)

 

See also the sample script ContourMap.bas in the \Samples\Scripts\ folder in the Surfer installation directory.

 


Surfer 9 and previous versions do not have the ability to load a CLR file or specify a preset colormap to a contour map in a script. Instead, you can specify the minimum and maximum colors and create a color gradation between them. For example:

 

'Set the colors to go from blue to red
n = Levels.Count
ColorInc = 255.0 / (n-1)
For i=1 To n
    ColorInc = 255.0 * (i-1) / (n-1)
    Levels(i).Fill.foreColor = RGB(ColorInc,0,255-ColorInc)
Next i

'Set the colors to go from blue to white
m = Levels2.Count
ColorInc2 = 255.0 / (m-1)
For j=1 To m
    ColorInc2 = 255.0 * (j-1) / (m-1)
    Levels2(j).Fill.foreColor = RGB(ColorInc2,ColorInc2,255)
Next j

 

See also the attached contourfill.bas script.

 

Updated September 27, 2017
 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.