Nonlinear Colormap / Legend

Hello all,

I have the following question.
I would like to create a non-linear legend in Paraview.


If I try to transfer these values to Paraview, the following legend appears.

Everything is “blue-shifted”.
I have also tried editing the JSON file.
The individual values are not taken over correctly.

The dots have the right colours (see arrow), but this is not usable.

I have the feeling that Paraview always wants the legend or at least the colours to be linear.
Hence my colour, how do I get the above legend set in Paraview. Or how does the corresponding JSON file look like.

If this has already been described in the help or here in the forum, please link it to me. I have been searching the forum and the help for a few days, but have not found anything suitable.

Thank you very much for your answers.

Best regards from Ulm

Rüdiger Fichtenau

Welcome to the ParaView community, @r.fichtenau.

ParaView supports two color mapping functions - linear and logarithmic. It does not support arbitrary color mapping functions.

This is a pity and essential for the evaluation of FEM results with regard to strength verification.

Is there no possibility to edit the colormap according to my ideas via macro or Plugin or…?

@cory.quammen Think this would be a worthy feature to add? I would say yes?


I can only agree with that.
I myself am not familiar with the programming of ParaView, but that should be implementable with a plugin or something similar.

I wonder if this can be done using Step mode or Categorical mode. Can you share your colormap @r.fichtenau ?

The top “wish” colormap comes from abaqus. I can therefore not share this. But actually I just want to specify my own non-linear areas.
The colormap I created in paraview is not good enough for me. But I am assuming a user error on my part.

If there is enough demand for this feature, then sure, it makes sense tackle.

At first glance I think it would actually be a significantly deep change in the color mapping implementation if we added direct support for arbitrary non-linear colormaps. Color mapping is surprisingly complex in ParaView.

That’s my guess too. But as I said, if you want to do a proper strength assessment, this is essential. My desired legend is scaled in the current case so that:
Value < 1: physically broken
Value 1 - 1.2: not broken but inadmissible
Value 1.2 - 1.5: minimum safety limit reached
Value > 1.5 medium safety limit reached

The values of 1.2 and 1.5 may vary depending on the requirement. 2.3 can also sometimes mean a safety limit.
Therefore, it would be desirable to have a tool for the colour map with which you can specify your number scale and vary the colours in between as desired.

I myself have been using abaqus, ansys and hyperview daily for over 10 years and this is possible in all packages. I don’t want to badmouth Paraview here, but only to show that this requirement is easy in other programmes. It is a standard functionality there.

Since this is currently not possible, I can only express the wish for an improvement or extension of the colormap.

We ourselves currently use Paraview for communication with our customers. It is an excellent tool with top functions!

Yes, you could run a filter such as Programmable Filter, Calculator, Python Calculator to map data ranges to category values e.g., [0.5, 1.0) → 0, [1.0, 1.2) → 1, and so on. Then you could color by this new category array, set the Number of Table values to the number of categories you have, turn off ticks and tick labels, and add annotations for the lower values of each range. The end result after doing that gets you this:


It’s a few minutes of work, but it is possible.

That doesn’t look so bad. Can you give the appropriate section in the help on how to implement this?

The documentation is here: 3. Color maps and transfer functions — ParaView Documentation 5.10.0 documentation Putting together the above required piecing together various bits of knowledge from that documentation - I’ll write up a tutorial when time allows. But for now, the pieces to look at are:

In the Color Map Editor panel itself:

  • Annotations
  • Number of Table Values

In the Edit Color Legend properties dialog (click on image to bring it up)

  • Horizontal Title (set to on)
  • Title Justification
  • Draw Tick Marks (set to off)
  • Draw Tick Labels (set to off)
  • Add Range Labels (set to off)
  • Ticks and Annotations Positions (to change them to be on the left or rigt)

As for mapping raw data values to the category array, I expect you could use some function from NumPy to convert from data value to bin using the Python Calculator. It looks like you can use numpy.digitize to do this in a one-liner.

Okay, thank you, I will try that.
But it may take a little time.

Nevertheless, I think that the colormap function in Paraview should be extended to include this function.