Sometimes user has multiple color map plot in multiple layers of one graph and wants them to have consistent look, e.g. same colormap levels and colors. A few lines of Labtalk Script will do the trick.
- Use Origin’s layer object Layer.CMap to control the number of color scale color levels, the Z values and the colors for all scale levels.
- Use Layer -o layerNumber / layerName {script} to execute the script in specified layer only.
- Use Doc -e LW {script} to execute the script to all layers in active graph window.
This blog demonstrate how to change z range of the colormap and load a different color palette for it and repeat the process for a specified layer or all layers.
Please download Multi_Layer_Colormap.zip and open the opj file in Origin. The graph has 10 layers of polar contour graph side by side. The z value range of the colormaps is from -0.043 to 0.043.
- With the graph window active, choose Window: Script Window menu to open the Script window.
- Copy and Paste the script below into the window. Highlight all lines and hit Enter key to execute it. The script will work on active layer, which is the top-left plot.
layer.cmap.zmin=-0.02;//set the minimum level to be -0.02 layer.cmap.zmax=0.02; //set the maximum level to be 0.02 layer.cmap.SetLevels(); //update the colormap with zmax change layer.cmap.load(rainbow.pal); //load rainbow palette layer.cmap.updateScale(); //check if the color map setting is valid, if so, redraw the graph
- If you want to do it for layer 5 (the first plot on right side), copy the following code into Script window. Highlight it and press ENTER key. This layer -o 5 will execute the script in {} in 5th layer only.
layer -o 5 { layer.cmap.zmin=-0.02;//set the minimum level to be -0.02 layer.cmap.zmax=0.02; //set the maximum level to be 0.02 layer.cmap.SetLevels(); //update the colormap with zmax change layer.cmap.load(rainbow.pal); //load rainbow palette layer.cmap.updateScale(); //check if the color map setting is valid, if so, redraw the graph }
- If you want to do it for all layers, copy the following code into Script window. Highlight it and press ENTER key. This doc -e LW will loop through all layers in active graph window.
doc -e LW { layer.cmap.zmin=-0.02;//set the minimum level to be -0.02 layer.cmap.zmax=0.02; //set the maximum level to be 0.02 layer.cmap.SetLevels(); //update the colormap with zmax change layer.cmap.load(rainbow.pal); //load rainbow palette layer.cmap.updateScale(); //check if the color map setting is valid, if so, redraw the graph }
Nice tutorial on how to use colormap levels and loop over layers.
If the user isn’t into scripting, he can manually set all the levels for one graph, then right click and select Copy Format/All, then right click anywhere in the graph page and select Paste Format (Advanced) and apply to All Graph Layers.