2.5.41 palApply

Menu Information

Graph: Apply Palette to Color Map

Brief Information

Apply specified palette to graph or image

Command Line Usage

1. palApply fname:=system.path.program$+"Palettes\RedWhiteBlue.pal";
2. palApply igl:=[Graph2]Layer1 fname:=system.path.program$+"Palettes\blue.pal" flip:=1; 

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Graph igl

Input

GraphLayer

<active>
Specifies the graph layer to which the palette is applied.
Palette File fname

Input

string

"grayscale"
Specifies the path and file name of the palette file to be applied.
Stretch to Full Range stretch

Input

int

1
If this checkbox is checked, 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.
Flip Palette flip

Input

int

0
Specifies whether or not to flip the order of colors in the palette when the palette is applied to the graph layer.
Apply Scope scope

Input

int

1
Specifies the graph that on the layer to apply palette.

Option list:

  • active:Active Plot
Apply the palette only in active plot on the layer.
  • all:All Plots
Apply the palette in all plots on the layer.


Description

This function applies an existing palette (*.PAL) file to a given graph layer. Note that color map should be available in the input graph layer. Otherwise, this X-Function can not be. Generally speaking, color maps are present in graphs such as 3D Surface Plots, Contour Plots, Image Plots, and in 2D plots where a particular attribute such as symbol size has been color mapped to the data in a worksheet column.

A typical palette file has 256 colors. A number of built-in palettes are provided. You can find them under the \Palettes subfolder of the Origin program folder. To create or edit user-defined palettes, another X-Function palEdit can be used.

Examples

  • Code Sample
/*
This example shows how to apply color palette on a graph layer.
The sample data is exe_path\Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat
1. Load sample data.
2. Convert random XYZ data into matrix by TPS method.
3. Plot a contour.
4. Use another color map.
*/
// Get sample data
fn$ = system.path.program$ + "Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat";
pn$ = system.path.program$ + "Palettes\RedWhiteBlue.pal";
newbook;
impASC fn$;
// Random worksheet to matrix gridding
xyz_tps 3 s:=0.05;
// Plot a contour
worksheet -p 226 contour;
// Turn off speedmode
speedmode sm:=0;

// Apply color map
palApply fname:=pn$

Keywords:color scale, color mapping