In this example:
TCanvas c("c","transparent canvas",200,10,700,500);
TH2F hist("hist", "hist", 10, -5, 5, 10, -5, 5);
hist.Draw();
TEllipse ell1(0.0, 0.0, 1.0, 1.0);
ell1.SetFillColor(kRed);
ell1.Draw();
TEllipse ell2(0.5, 0.5, 1.0, 1.0);
ell2.SetFillStyle(4000);
ell2.SetLineStyle(kDashed);
ell2.Draw();
c.SaveAs("ellipses.png");
c.SaveAs("ellipses.eps");
c.SaveAs("ellipses.pdf");
I used SetFillStyle(4000)
on ell2
to make it transparent.
.png shows the result that is expected:
while in .pdf and .eps ell2
became opaque:
What is happening and what can we do to obtain the desired result in .pdf and .eps formats?
Also there is an old similar post begging to be answered - https://root-forum.cern.ch/t/error-in-saving-the-figure-made-by-tarc-or-tellipse/18336
ksmith
2
https://root.cern.ch/doc/master/classTAttFill.html#F2
According to the above documentation you should use SetFillStyle(0)
, the note at the bottom may also be true for TEllipse
.
using SetFillStyle(0)
on TEllipse
worked.
couet
4
Note also that with a solid filling it is possible (depending on which platform you are running) to have transparent color as explained here.
system
Closed
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.