Color transfer function values in pvpython

Hi there,

I’m attempting to change the colour of a section within a colour bar without impacting the overall gradient on the points outside the changed section.

The closest I have been to achieving this has been through the GUI:

  • Using the default colour bar, there are 3 data points in the ‘color transfer function values’ table - Image 1.
  • Clicking on the colour bar, I can add more values to the table, each inheriting the RBG value to maintain the natural gradient - Image 2.
  • Then I edit a few of these points and I have a yellow section within the un-affected gradient - Image 3.

Is there a way to obtain the RGB values for certain data points using pvpython?
I’ve not found a way to specify a data point (e.g. 0.3 in the example of my images) and have pvpython return the RBG values that correspond.

Best wishes,

You can get the lookup table object in Python and access its color points with:

lut = GetColorTransferFunction('vOSI')

RGBPoints is a list of doubles in the order (value_0, red_0, green_0, blue_0, value_1, red_1, green_1, blue_1, ...) You can set the RGB points with

lut.RGBPoints = [25.32328370098179, 0.231373, 0.298039, 0.752941, 2474.27393603584, 0.865003, 0.865003, 0.865003, 4923.224588370698, 0.705882, 0.0156863, 0.14902]

for data points 25.32328370098179, 2474.27393603584, and 4923.224588370698, for instance.

Hope that helps!