Color doesn't show up when saved as eps or pdf

Dear Root experts,

I currently have a problem that when I save my Canvas I don’t reproduce what I see on the screen unless I save it as a giff, jpeg or png. Maybe that issue is known and a quick work around can be provided?

please see code below in order to reproduce the problem
Michael

{
//=========Macro generated from canvas: C_ph_pT_unfold_ratio/C_ph_pT_unfold_ratio
//=========  (Mon Feb  9 20:36:24 2015) by ROOT version5.34/11
   TCanvas *C_ph_pT_unfold_ratio = new TCanvas("C_ph_pT_unfold_ratio", "C_ph_pT_unfold_ratio",300,123,950,500);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   C_ph_pT_unfold_ratio->SetHighLightColor(2);
   C_ph_pT_unfold_ratio->Range(0,0,1,1);
   C_ph_pT_unfold_ratio->SetFillColor(0);
   C_ph_pT_unfold_ratio->SetBorderMode(0);
   C_ph_pT_unfold_ratio->SetBorderSize(2);
   C_ph_pT_unfold_ratio->SetTickx(1);
   C_ph_pT_unfold_ratio->SetTicky(1);
   C_ph_pT_unfold_ratio->SetLeftMargin(0.16);
   C_ph_pT_unfold_ratio->SetRightMargin(0.05);
   C_ph_pT_unfold_ratio->SetTopMargin(0.05);
   C_ph_pT_unfold_ratio->SetBottomMargin(0.16);
   C_ph_pT_unfold_ratio->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0.8,0,1,1);
   pad2->Draw();
   pad2->cd();
   pad2->Range(0,0,1,1);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.16);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0.05);
   pad2->SetBottomMargin(0.16);
   pad2->SetFrameBorderMode(0);

   TPave *pave = new TPave(0.0024,0.303,0.058,0.33,1,"brNDC");
   pave->SetFillColor(33);
   pave->SetFillStyle(1);
   pave->Draw();
      tex = new TLatex(0.1,0.305,"Scale Uncert.");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.12);
   tex->SetLineWidth(2);
   tex->Draw();
   pave = new TPave(0.0024,0.253,0.058,0.28,1,"brNDC");
   pave->SetFillColor(35);
   pave->SetFillStyle(1);
   pave->Draw();
      tex = new TLatex(0.1,0.255,"Total");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.12);
   tex->SetLineWidth(2);
   tex->Draw();
  
   C_ph_pT_unfold_ratio->cd();
   C_ph_pT_unfold_ratio->Modified();
   C_ph_pT_unfold_ratio->cd();
   C_ph_pT_unfold_ratio->SetSelected(C_ph_pT_unfold_ratio);
}
1 Like

With ROOT 5.34/25 and the following macro I get the attached output.

{
   TCanvas *C_ph_pT_unfold_ratio = new TCanvas("C_ph_pT_unfold_ratio", "C_ph_pT_unfold_ratio",300,123,950,500);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   C_ph_pT_unfold_ratio->SetHighLightColor(2);
   C_ph_pT_unfold_ratio->Range(0,0,1,1);
   C_ph_pT_unfold_ratio->SetFillColor(0);
   C_ph_pT_unfold_ratio->SetBorderMode(0);
   C_ph_pT_unfold_ratio->SetBorderSize(2);
   C_ph_pT_unfold_ratio->SetLeftMargin(0.16);
   C_ph_pT_unfold_ratio->SetRightMargin(0.05);
   C_ph_pT_unfold_ratio->SetTopMargin(0.05);
   C_ph_pT_unfold_ratio->SetBottomMargin(0.16);
   C_ph_pT_unfold_ratio->SetFrameBorderMode(0);

   TPad *pad2 = new TPad("pad2", "pad2",0.8,0,1,1);
   pad2->Draw();
   pad2->cd();
   pad2->Range(0,0,1,1);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetLeftMargin(0.16);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0.05);
   pad2->SetBottomMargin(0.16);
   pad2->SetFrameBorderMode(0);

   TPave *pave = new TPave(0.0024,0.303,0.058,0.33,1,"brNDC");
   pave->SetFillColor(33);
   pave->Draw();

   TLatex *tex = new TLatex(0.1,0.305,"Scale Uncert.");
   tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.12);
   tex->Draw();

   TPave *pave = new TPave(0.0024,0.253,0.058,0.28,1,"brNDC");
   pave->SetFillColor(35);
   pave->Draw();

   tex = new TLatex(0.1,0.255,"Total");
   tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.12);
   tex->Draw();

   C_ph_pT_unfold_ratio->Print("C_ph_pT_unfold_ratio.pdf");
   C_ph_pT_unfold_ratio->Print("C_ph_pT_unfold_ratio.png");
}

C_ph_pT_unfold_ratio.pdf (12.4 KB)

ok thanks,

that also works with the root version I am using and the problem is this line

pave->SetFillStyle(1);

so when I comment this out everything is fine I just don’t know why it causes problems

cheers Michael