Using color from RainBow palette for Eve Shape

Hello ROOT team,
I have to fill EveShape with the color, but the color value is generated at run time and is coming as float value like 0.2 , 0.45, 0.48, 0.6 , 0.67 etc. As a result of float value i am not getting colored boxes,
It is possible to assign color based on RainBow color palette.

If yes then could you please tell how to proceed.

TEveShape::SetFillColor has a TColor as parameter. In your program you should build a TColor with the float (RGB) numbers you have and pass it to SetFillColor.

Yes, you need something like this (not tested!):

   TColor::SetPalette(1, 0); // Spectrum palette
   const Int_t nCol = TColor::GetNumberOfColors();
   float min, max; // your range of values

  // for each shape
  shape->SetMainColor(TColor::GetColorPalette((shape_value - min)/(max-min) * nCol));

If you can get by with simple shapes supported by TEveQuadSet / TEveBoxSet … you can modify the visibility / mapping of the palette in the gui at runtime (see tutorials/eve quadset.C and boxset.C). This is meant for display of digis so it works with integers only and you’d have to scale up your values by 100.

Matevz

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.