Set Title Box and Legend Boxes as Transparent

I am trying to save histograms to PDF with no fills at all, and by reading through other posts, I’ve almost gotten there. I currently have the following commands in my rootlogon.C :

gStyle->SetCanvasColor(-1);
gStyle->SetPadColor(-1);
gStyle->SetFrameFillColor(-1);
gStyle->SetHistFillColor(-1);
gStyle->SetFillColor(-1);

This makes the pad and the interior of the histogram transparent in PDF, but the title box and the legend still have solid fills. I’ve tried the following to get rid of the fill in the title box:

gStyle->SetTitleFillColor(-1);

But the title box is still white. Is it possible to make this box transparent, or ideally to make the box go away entirely so that the title is just text without an enclosure?

I also wonder if it’s possible to make other boxes like a legend transparent, but I suspect that would mean that they would then show histogram graphics underneath, which would be undesirable in most cases. Do these boxes take their color from the input to TStyle::SetFillColor?

Many thanks,
Jeff

In your rootlogon.C you can do:

gStyle->SetStatStyle(0);
gStyle->SetTitleStyle(0);
gROOT->ForceStyle();

That definitely helps. I’ve managed now to get things pretty much exactly how I want them, using this combination:

gStyle->SetCanvasColor(-1);
gStyle->SetPadColor(-1);
gStyle->SetFrameFillColor(-1);
gStyle->SetHistFillColor(-1);
gStyle->SetTitleFillColor(-1);
gStyle->SetFillColor(-1);
gStyle->SetFillStyle(4000);
gStyle->SetStatStyle(0);
gStyle->SetTitleStyle(0);
gStyle->SetCanvasBorderSize(0);
gStyle->SetFrameBorderSize(0);
gStyle->SetLegendBorderSize(0);
gStyle->SetStatBorderSize(0);
gStyle->SetTitleBorderSize(0);

The end result is transparency everywhere and no boxes around the title or the legend. Again, thanks for the help.

Thank you very much for this post!
-Penny