Transparent TPave

ROOT Version: 6.10/06
Platform: Linux

#include "TPave.h"
#include "TLine.h"

void test() {
  TLine *l = new TLine(0.3,0.3,0.5,0.5);
  TPave *pave = new TPave(0.2,0.2,0.7,0.7,0);
  pave->SetFillColorAlpha(kRed,0.5); //0.5 should be semi-transparent

The piece of code above does not show the blue line (that is behind the TPave) whereas I asked for the TPave be semi-transparent. Is SetFillColorAlpha working well?

it works for me: (Mac, Cocoa backend, ROOT 6.15)

you need (I am on Ubuntu 16.04.4, r6.14.00)

root [2] gStyle->SetCanvasPreferGL(kTRUE);
root [3] test()


See the paragraph about transparency in the TColor documentation.

You can read:

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 … but not PostScript.

Indeed, I missed this point. With the


I see the transparency.


OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc

OpenGL.CanvasPreferGL is set to 1 in $ROOTSYS/etc/system.rootrc

What is the reason why this is not enable by default?

This triggers the OpenGl backend which is not what people want usually .

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