3.7.5.35 Layer.CMap

LabTalk Object Type:

window


The cmap object is a sub-object of the layer object. It controls the number of color scale color levels, the Z values and the colors for all scale levels (including "in excess of", "less than" and "missing").


Properties:

Property Access Description
layer.cmap.colorAbove Read/write,
numeric

Color to represent Z values in excess of zMax. Example:

layer.cmap.colorAbove=0;

Sets colorAbove to Black (Origin's 0th color).

layer.cmap.colorBelow Read/write,
numeric

Color to represent Z values below zMin. Example:

layer.cmap.colorBelow=17;

Sets colorBelow to White (Origin's 17th color).

layer.cmap.colorHigh Read/write,
numeric

Color to represent highest Z value range. Example:

layer.cmap.colorHigh=1;

Sets colorHigh to Red (Origin's 1st color).

layer.cmap.colorlist$ Read/write,
string

Specify a color list to be colormap fill

layer.cmap.colorlist$="Candy.oth"; //Use Candy as colormap fill.
layer.cmap.colorLow Read/write,
numeric

Color to represent lowest Z value range. Example:

layer.cmap.colorlow=3;

Sets colorLow to Blue (Origin's 3rd color).

layer.cmap.colorMiss Read/write,
numeric

Color to represent missing Z values. Example:

layer.cmap.colormiss=10;

Sets colorMiss to Wine (Origin's 10th color).

layer.cmap.colorMixMode Read/write,
numeric

Fill color mixing mode.
0 = limited mixing.
1 = introducing other colors in mixing. Example:

layer.cmap.colormixmode=1;

Sets colorMixMode to use "Introduce Other Colors in Mixing."

layer.cmap.colorN Read/write,
numeric

The nth color, where n is 1 to numColors. Example:

layer.cmap.color4=2;

Sets the color for the 4th level to Green (Origin's 4th color).

layer.cmap.firstLevel

Minimum Origin Version Required: 8.5.0

See also: Note 1.
Read/write,
numeric

The first major level.

layer.cmap.inc


See also: Note 1.

Read/write,
numeric

Set/Get the increment between color levels in the palette. Example:

layer.cmap.inc=1;     // Set increment to 1

Setting inc turns off numMajorLevels selection.

layer.cmap.labelN Read/write,
numeric

Show/Hide the nth label. Example:

layer.cmap.label1=1;  // Show label 1
layer.cmap.label2=0;  // Hide label 2
layer.cmap.labelAbove Read/write,
numeric

Show/Hide a label corresponding to values above the color scale. Example:

layer.cmap.labelAbove=1;    // Show a label above the color scale
layer.cmap.labelAbove=0;    // Hide a label above the color scale
layer.cmap.lineN Read/write,
numeric

Show/Hide the line at the nth level. Example:

layer.cmap.line1=1;  // Show line at level 1
layer.cmap.line2=0;  // Hide line at level 2
layer.cmap.lineAbove Read/write,
numeric

Show/Hide a line above the color scale. Example:

layer.cmap.LineAbove=1;  // Show the line above the color scale
layer.cmap.LineAbove=0;  // Hide the line above the color scale
layer.cmap.lineColorN Read/write,
numeric

Change the color of the nth line. Example:

layer.CMap.LineColor1 = 0;   // Change the line color at level 1
layer.CMap.LineColor2 = 1;   // Change the line color at level 2
layer.cmap.lineColorAbove Read/write,
numeric

Change the color of the above line. Example:

layer.CMap.LineColorAbove = 1;   // Change the color of the above line
layer.cmap.lineColorLink Read/write,
numeric

Link Line to Colormap Color. Example:

layer.CMap.lineColorLink= 1;   // Contour Lines will match the colormap color at each level.
layer.cmap.lineStyleN Read/write,
numeric

Change the line style of the nth line.

Line style type:

  • 0 or 1 = solid
  • 2 = dash
  • 3 = dot
  • 4 = dash dot
  • 5 = dash dot dot
  • 6 = short dash
  • 7 = short dot
  • 8 = short dash dot

Example:

layer.CMap.LineStyle1 = 0.5;   // Change the line style at level 1
layer.CMap.LineStyle2 = 1.0;   // Change the line style at level 2
layer.cmap.lineStyleAbove Read/write,
numeric

Change the line style of the above line.

Line style type:

  • 0 or 1 = solid
  • 2 = dash
  • 3 = dot
  • 4 = dash dot
  • 5 = dash dot dot
  • 6 = short dash
  • 7 = short dot
  • 8 = short dash dot

Example:

layer.CMap.LineStyleAbove = 5;   // Change the line style of the above line
layer.cmap.lineWidthN Read/write,
numeric

Change the line width of the nth line. Example:

layer.CMap.LineWidth1 = 0.5;   // Change the line width at level 1
layer.CMap.LineWidth2 = 1.0;   // Change the line width at level 2
layer.cmap.lineWidthAbove Read/write,
numeric

Change the line width of the above line. Example:

layer.CMap.LineWidthAbove = 1.5;   // Change the line width of the above line
layer.cmap.numColors


See also: Note 1, 2.

Read/write,
numeric

The number of color levels. Example:

layer.cmap.numcolors=8;

Use 8 color levels.

layer.cmap.numMajorLevels


See also: Note 1.

Read/write,
numeric

The number of major color levels. Example:

layer.cmap.numMajorLevels=5;

Setting numMajorLevels turns off inc selection.

layer.cmap.numMinorLevels


See also: Note 1.

Read/write,
numeric

The number of minor color levels. Example:

layer.cmap.numMinorLevels=0;

Use 0 minor color levels.

layer.cmap.palette$ Read/write,
string

Specify the color palette. Example:

layer.cmap.palette$ = ;  // Return color palette used
layer.cmap.linkpal Read/write
string

If value=1, link the color filling to the selected palette.

layer.cmap.flippal Read/write
numeric

If value=1, flip the order of colors in the selected palette and map it to the existing color levels.

layer.cmap.stretchpal Read/write
numeric

If value=1, the colors in the palette will be repeated or skipped to n, where n is the number of color map levels in the input graph layer. If this checkbox is clear and n is less than 256, only the first n colors in the palette will be used. If the checkbox is clear and n is more than 256, the entire set of colors in the palette will be repeated as many times as needed.

layer.cmap.transparency Read/write
numeric

get/set colormap transparency

layer.cmap.type


See also: Note 1.

Read/write,
numeric

Color map scale type.

  • 0 or 1 = linear
  • 2 = log10
  • 3 = probability
  • 4 = probit
  • 5 = reciprocal
  • 6 = offset reciprocal
  • 7 = logit
  • 8 = ln
  • 9 = log2

Example:

layer.cmap.type=2;    // Log10 scale
layer.cmap.zAbove

(9.0 SR0)

Read/write,
numeric

The maximum value of the color scale. By default, the zAbove value = the maximum value of the colormap.

layer.cmap.zAbove=; //Get the maximun value of the color scale

If we use layer.cmap.zN to set the new Z value for the Nth level and that value exceeds the origin maximun Z value, you can use this script to increase the range.

layer.cmap.zAbove=100; //Set the maximun value of the color scale to 100
layer.cmap.zMax


See also: Note 1.

Read/write,
numeric

The maximum Z value for colorHigh. Example:

layer.cmap.zmax=50;

Sets zMax (the upper end of the scale) to 50.

layer.cmap.zMin


See also: Note 1.

Read/write,
numeric

The minimum Z value for colorLow. Example:

layer.cmap.zmin=0;

Sets zMin (the lower end of the scale) to 0.

layer.cmap.zMissing Read/write,
numeric

The Z value assigned to missing Z values. Example:

layer.cmap.zmissing=-1;

Use a value of -1 for zMissing.

layer.cmap.zN Read/write,
numeric

The nth Z level, where n is 1 to numColors. Example:

layer.cmap.z4=22.5;

Sets the Z value for the 4th level to 22.5.

Note:

  1. When changing the following properties, you should call layer.cmap.SetLevels() to reset the color map, and then call layer.cmap.updateScale() to redraw the graph. Including:
    • layer.cmap.zMax
    • layer.cmap.zMin
    • layer.cmap.numMajorLevels
    • layer.cmap.numMinorLevels
    • layer.cmap.inc
    • layer.Cmap.numColors
    • layer.Cmap.firstLevel
    • layer.cmap.type
  2. layer.cmap.numColors = N;
    is equivalent to
    layer.cmap.numMajorLevels = N; layer.cmap.numMinorLevels = 0;

Methods:

Method Description
layer.cmap.delete(n)

(9.0 SR0)

Delete the nth level value. (n=1,2,...numColors).

layer.cmap.fill(method)

Set the fill colors.

  • method = 1, fill the levels with a linear mix of the specified minimum and maximum fill level colors.
  • method = 2, Origin automatically introduce complementary colors into the mix to fill the levels.
layer.cmap.insert(n)

(9.0 SR0)

Insert a level value between the nth level and the previous level. (n=1,2,...numColors+1).

layer.cmap.load(file, option=0)

Load the color maps (*.pal or *.xml file) to the contour graph.

  • file, the location of the file to be loaded. If it is specified with only file name but without a full path, it will try to load the file from User Files Folder.
  • option, not used currently.
layer.cmap.save(file, option=0)

Save the color maps as *.pal or *.xml file. The *.xml file will save both color and Z level values, but the *.pal file only save color values.

  • file, the name of file to be saved. If it is specified with only file name but without a full path, the file will be saved to User Files Folder.
  • option, not used currently.
layer.cmap.setLevels(method)

Set color levels.

  • method is Null (Not specified):
    Use the prepared color map settings, like zmin, zmax, etc., and the Original colormap level options, like increment, major levels, etc., to update the colormap.

    Minimum Origin Version Required: 8.5.0

  • method = 0:
    Update colormap by Origin default settings. That is:
    • Reset From/To to be minimum or maximum of Z values;
    • Reset scale type to be Linear;
    • Reset the color from Blue to Red;
  • method = 1:
    Reset the color levels using zmin, zmax, type, numMajorLevels and numMinorLevels.
  • method = 2:
    Reset the color levels using zmin, zmax, type, inc and numMinorLevels.
layer.cmap.setZLevels(dataset, n)

(9.0 SR0)

Set the z level values, starting from the nth level.

Restriction of the dataset:

  • The size of dataset must be <=numColors+1
  • The size of dataset + n must be <=numColors+1
  • The dataset must be strictly increasing
layer.cmap.showLabels(method)

Control the visibility of contour labels.

  • method = 1, show the labels only on the major levels.
  • method = 2, show all contour labels.
  • method = 3, hide all contour labels.
layer.cmap.showLines(method)

Control the visibility of contour lines.

  • method = 1, show the lines only on the major levels.
  • method = 2, show all contour lines.
  • method = 3, hide all contour lines.
layer.cmap.updateScale()

Check if the color map setting is valid, if so, redraw the graph. Same as doc -uw.

Examples:

The following script shows how to set color map properties and apply the settings.

win -t mat;
matrix -v i;
run.section(Plot3D,ColorMap);
sec -p 1;
layer.cmap.zmax=10;
sec -p 1;
layer.cmap.SetLevels();
sec -p 1;
layer.cmap.updateScale();

The following script shows how to set z level.

win -t matrix origin;
matrix -ps dim 10 10;
matrix -v sin(x)+cos(y);
run.section(Plot3D,ContourColor);

layer.cmap.NUMMINORLEVELS=2;
layer.cmap.NUMMAJORLEVELS=3;
//ds size must be Major*(Mnor+1)+1
dataset ds={-1.8, -1.6, -1.4,-1.2, -1, 0 ,1,  1.2, 1.4, 1.8};
//call SetLevels first to setup internal array size before you can call setZLevels
layer.cmap.SetLevels();
layer.cmap.setZLevels(ds, 0);