Setting the opacity of histogram line?

Hi everyone,

I am trying to set the opacity of a TH1F histogramh_singles (red) line using

h_singles->SetLineColorAlpha(kRed, 0.164);

However, I am not seeing any visible changes in the canvas. Numerically I can see the opacity has been set but it doesn’t appear to be the case from visual inspection.

Can someone please suggest what is the right way of going about this?

Thanks a ton !

Edit 1: I think when I export to pdf (not png)it works.
image

As said here:

The transparency is available on all platforms when the flag OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc , or on Mac with the Cocoa backend. On the file output it is visible with PDF, PNG, Gif, JPEG, SVG, TeX … but not PostScript.

1 Like

Thanks a lot for pointing the issue.