Hi, I have this test case where I’m plotting two simple scatter plots with semi-transparent markers.
Here’s the output (sorry for the odd tiled image, forum prevents two uploads for new users…). On top when I view it from GUI, rendered correctly. Bottom the same plot saved as pdf and rendered with evince. See the wrong transparency on the blue plot.
I’m pretty new with ROOT, looks like a bug to me, but I could totally be doing something wrong. Here’s the code, compiling it with
clang++ -Wall `root-config --cflags --libs` -lGL -o testalpha testalpha.C
By the way, is there a way to get automatic canvas ranges to extend to both scatterplots when drawing from TTree::Draw?
#include <TROOT.h>
#include <TRandom3.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TNtuple.h>
#include <TApplication.h>
void testalpha() {
TNtuple *ntu=new TNtuple("ntu", "ntu", "a:b:c:d");
for (int i=0; i < 5000; i++) {
double a = gRandom->Gaus()-1;
double b = gRandom->Gaus()-1;
double c = gRandom->Gaus()+1;
double d = gRandom->Gaus()+1;
ntu->Fill(a, b, c, d);
}
auto c = new TCanvas("ctest", "", 600, 600);
ntu->SetMarkerStyle(20);
ntu->SetMarkerColorAlpha(kBlue, .2);
ntu->Draw("a:b");
ntu->SetMarkerStyle(20);
ntu->SetMarkerColorAlpha(kRed, .2);
ntu->Draw("c:d", "", "same");
c->Draw();
c->SaveAs("testalpha.pdf");
}
int main(int argc, char *argv[]) {
TApplication app("app", &argc, argv);
gStyle->SetCanvasPreferGL(true);
testalpha();
app.Run();
return 0;
}
ROOT Version: 6.19/01 (heads/master@v6-19-01-562-g07764afae9)
Platform: Ubuntu 18.10
Compiler: clang++ 7.0.0
