Drawing a Gradient Palette range in TEveManager

Hello again,

I made boxes to represent hits in an event viewer (using TEveBoxSet). The colour of each box represents a value (energy deposit for instance). I defined a gradient ColorPalette according to the code below but I would like to display an axis with the full range somehow in the viewer (something like a TPaletteAxis in a 2D histogram) so that we know e.g if dark blue is the highest or the lowest value.
See picture attached.

Is there a way to do this?

Thanks a lot,


ColorPalette=np.array([0], dtype=np.int32)
NRGBs = 5
stops = np.array( [0.00, 0.34, 0.61, 0.84, 1.00] )
red = np.array( [0.00, 0.00, 0.87, 1.00, 0.51] )
green= np.array( [0.00, 0.81, 1.00, 0.20, 0.00] )
blue= np.array( [0.51, 1.00, 0.12, 0.00, 0.00] )
FI=TColor.CreateGradientColorTable(NRGBs, stops, red, green, blue, ncolors)
for i in range(ncolors): ColorPalette=np.append(ColorPalette,FI+i)

ROOT 6.10/08 mac os 10.13.4

I think @matevz may have an idea.


Look at tutorials/eve boxset.C and overlay_palette.C.

The idea is that you tell Digit/Quad/BoxSet about the palette and set DigitValue for each box. Then you get controls for the min/max values and choice what to do with overflow/underflow (and even plot histos from the second tab).


ok perfect thanks looks like overlay_palette is what I need.

Hi again,
so all ok to set the colours of the TEVEBoxSet according to a TEveRGBAPalette (colours still not great need to work on this), however the overlay palette is nowhere to be found in the viewer. I tried playing with the position of the overlay palette at declaration tried to update the GLViewere in many different ways. See part of the code below and a snapshot.

po=TEveRGBAPaletteOverlay(pal, 0, 0, 40, 500); #I tried playing with different positions height and width

#... not shown load gdml geometry ad it to TEVEmamanger

#... not shown loop on event and create TEVEBoxset, set the digit color and add it to TEve...

#now try to draw the palette in the viewer
f3DView.GetGLViewer().SetGuideState(ROOT.TGLUtil.kAxesOrigin, ROOT.kTRUE, ROOT.kFALSE, GuideRef)

#Palette is not shown see drawing

It would be better to format your posts according to the rules described here:
It will make them more readable.

ok thanks for the comment. I added code tags, I think it is more readable now

Yes it is :slight_smile: Thanks

Grrr … indeed it does not show up. Will investigate later today. Sorry about that :frowning:

Adding SetupColorArray() call like this apparently fixes the problem.

TEveRGBAPalette *p = new TEveRGBAPalette(0, 100);

If the palette is actually used by a DigitSet() this call should be made automatically before overlay rendering is reached in the GL viewer.

Indeed there it is thanks! (No way I would have found this myself :slight_smile: )

See also some comments about the rainbow color map:

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