Set line color transparent

How to set histogram line color transparent?
The goal is to avoid artifacts as in the following case:

TH1F *h = new TH1F(“test”, “test”, 2, 0, 2);
TH1F *h2 = new TH1F(“test2”, “test2”, 2, 0, 2);
h -> SetBinContent(1, 1.0);
h -> SetBinContent(2, 3.0);
h2 -> SetBinContent(1, 1.0);
h2 -> SetBinContent(2, 2.0);
h-> SetMarkerStyle(kFullCircle);
h -> SetMarkerColor(kBlack);
h -> SetLineColor(kWhite);
h2 -> SetMinimum(0.0);
h2 -> Draw();
h -> Draw(“ESAME”);

I understand you want to see only the marker in that case ?

Something like that ?

void viest(){
   TH1F *h = new TH1F("test", "test", 2, 0, 2);
   TH1F *h2 = new TH1F("test2", "test2", 2, 0, 2);
   h->SetBinContent(1, 1.0);
   h->SetBinContent(2, 3.0);
   h2->SetBinContent(1, 1.0);
   h2->SetBinContent(2, 2.0);
   h->SetMarkerStyle(kFullCircle);
   h->SetMarkerColor(kBlack);
   h->SetLineColor(kWhite);
   h2->SetLineColor(kWhite);
   h2->SetMinimum(0.0);
   h2->Draw();
   h->Draw("ESAME");
}

No. I want only the marker of h survive.

yes that’s what I meant … see what I posted … is that what you want ?

No! I want markers from h and line from h2.

Ah ok.

here we are:

void viest(){
   TH1F *h = new TH1F("test", "test", 2, 0, 2);
   TH1F *h2 = new TH1F("test2", "test2", 2, 0, 2);
   h->SetBinContent(1, 1.0);
   h->SetBinContent(2, 3.0);
   h2->SetBinContent(1, 1.0);
   h2->SetBinContent(2, 2.0);
   h->SetMarkerStyle(kFullCircle);
   h->SetMarkerColor(kBlack);
   h->SetLineColor(kWhite);
   h2->SetMinimum(0.0);
   h2->Draw();
   h->Draw("PSAME");
}

1 Like

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