Change post map labels via Surfer automation

All of the available post map label properties can be found in the PostLayer Object Help topic in the Properties table.  The script below demonstrates how to create a post map with a label column, assign it to the overlays collection, and then adjust several label properties.

 

For example:

Set MapFrame = Plot.Shapes.AddPostMap(SurferApp.Path+"\samples\demogrid.dat", LabCol:=3)
Dim PostLayer As Object
Set PostLayer = MapFrame.Overlays(1)

'Sets the label format properties. For all options, see LabelFormat object.
PostLayer.LabelFormat.NumDigits = 1
PostLayer.LabelFormat.Type = srfLabFixed

'Sets the label font properties. For all optiosn, see FontFormat object.
PostLayer.LabelFont.Face = "Comic Sans MS"
PostLayer.LabelFont.Size = 14
PostLayer.LabelFont.ForeColorRGBA.Color = srfColorBlue
PostLayer.LabelFont.Bold = True

'Sets the angle for the label text
PostLayer.LabelAngle = 30

'Sets the label position relative to the symbol
PostLayer.LabelPos = srfPostPosUser
PostLayer.LabelPos = srfPostPosUser

'Sets the X and Y offset for custom label positions relative to the symbol. This is only active if the LabelPos above is set to User (User Defined).
PostLayer.LabelXOffset = 0.02
PostLayer.LabelYOffset = 0.01

'Sets the 3D label line properties. See LineFormat object for all line property options.
PostLayer.LabelLine.ForeColorRGBA.Color = srfColorGreen

'Sets the length of the 3D label lines
PostLayer.LabelLineLength = 0.5

'Sets the plane for the labels
PostLayer.LabelPlane = srfPostScreen

 

See also the attached script PostMap.bas, which can also be found in the \Samples\Scripts\ folder in the Surfer installation directory.

 

Updated November 2021

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.