Making bar transparent in a scatter plot

Dear Experts,

I have plotted scatter plot as attached. I have drawn two bars on that plot. I want to make these two bars transparent so that I can see the data points. I have written in the macro as below.

TCanvas *cv1 = new TCanvas(“cv1”,"",600,600);
tr->Draw(“Bmass : Mumumass >> h_mm”,selbm1);

TBox *bx1 = new TBox(2.946,5.1,3.177,5.6);
bx1->SetFillColor(kMagenta);
bx1->Draw();

TBox *bx2 = new TBox(3.586,5.1,3.766,5.6);
bx2->SetFillColor(kMagenta);
bx2->Draw();

Thanks in advance.

Thanks,
Deepak

Hi,

did you try to set the colour alpha? https://root.cern.ch/doc/master/classTAttFill.html#a5fff502945c593f3387176d01b4c22ea

Cheers,
D

Hi,

I have tried with alpha. But it is not working.

Thanks,
Deepak

Hi,

what ROOT version are you using on what platform and with what configuration parameters?

Cheers,
D

Try a brutal fix … after drawing both boxes, add:
tr->Draw(“Bmass : Mumumass”, selbm1, “same”);

Alpha is not supported for all graphics output:

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

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