New in ParaView: Changes to color/opacity presets

September 14, 2015

In ParaView, color presets provide a way for user to access of palette of predefined color maps that can be used for pseudocoloring datasets using data variables. Management of presets in ParaView has been revamped for ParaView 4.4 There were several major focuses of this new work including making the UI easier to use, adding support for opacity transfer functions in presets, and ability to access the presets in Python scripts. In this article we take a fresh look at presets.

Accessing the presets

Presets can be accessed using the Color Map Editor panel. When the active source is being colored (or pseudocolored) using a data variable in the active view, the Color Map Editor panel can be used to fine tune the scalar to colors (or opacities) mapping. While you can always manually setup the color and opacity transfer functions, you can also load a preset. To popup the Choose Preset dialog, you use the icon. It’s shown under the Mapping Data group  (Figure 1: left) or Annotations group (Figure 1: right), if using categorical color mapping.


Figure 1: Color Map Editor panel showing the Choose Preset button to access the Preset dialog.

Navigating the Choose Preset dialog

The preset dialog how support searching for presets by name. You can enter text in the Search box to filter the list of presets shown, similar to Properties Panel and such other panels in ParaView. To select (or activate) a preset, you must click on it in the Presets table. Selecting or activating a preset doesn’t result in loading the preset. To load or apply the preset to the transfer function, you can double-click on it in the Presets​ table or select it and then use the Apply button. When applying a preset, the checkboxes under Options to load: control how the preset gets loaded. Colors is enabled for presets that provide a color transfer function i.e. a color map. Check/uncheck Colors to load/not-load the color control points. Opacities is enabled for presets that have provide an opacity transfer function. Check/uncheck Opacities to control whether opacity mapping is loaded from the preset or not. Presets are often written for a specific scalar range. When applying a present, you generally want the current scalar range to be preserved and the preset scaled to match the current range. If that’s not the case, and you saved a preset for specific scalar range in mind, simply check the Use preset range check box. That will preserve the range from the present and override the current transfer function range, as needed.

The Import/Export buttons allow you to import or export preset. To export presets, simple select one or muliple presets in the Presets table and then click the Export button. Presets are exported in a JSON format that is consistent with the format used for settings.

Remove can be used to remove an imported preset. The button is not enabled for any of the builtin presets.

The Choose Preset dialog is quite similar for categories color maps, the only difference is that the Options to load: list is different.

Annotations is enabled if the preset has annotation labels available and checking/unchecking it will load/not-load such annotations when the preset is applied.

Saving a preset

You can save your current color (and opacity) maps as a preset using the button on the Color Map Editor. That will pop up the Save Preset Options dialog that allows you to pick whether to save the opacity map with the preset as well. Check the Save opacities checkbox to save opacities along with the color in the present. While saving a preset doesn’t provide the option to now save color map, users can always pick to load only opacities when applying a preset.


If a preset has opacities, the Choose Preset dialog overlay a representation of the opacity transfer function on the color map as shown below.

Python API

ParaView 4.4 how supports an API to load presets through Python. You can simply use the tracing capabilities to determine the calls to make to load a specific preset (assuming a unique name).

from paraview.simple import *

# get color transfer function/color map for 'RTData'
rTDataLUT = GetColorTransferFunction('RTData')

# get opacity transfer function/opacity map for 'RTData'
rTDataPWF = GetOpacityTransferFunction('RTData')

# Loading a color map alone
# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
rTDataLUT.ApplyPreset('Rainbow Desaturated', True)

# Loading a color and opacity map and preserve preset ranges
# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
rTDataLUT.ApplyPreset('My Preset', False)

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
rTDataPWF.ApplyPreset('My Preset', False)

2 comments to New in ParaView: Changes to color/opacity presets

  1. Hi, I am using Paraview 5.0.1. Regarding presets, I can select a preset and make it as default in the older versions. However with 5.0.1, I am not able to find the “make as default” option. How to make a particular preset as default in 5.0.1?

Leave a Reply