Hello,
When I draw a THStack, a horizontal line y=0 is also drawn. How to remove this line? Thanks.
void fill_tree(const char *treeName, const char *fileName)
{
ROOT::RDataFrame d(25000);
d.Define("px", []() { return gRandom->Gaus(); })
.Define("py", []() { return gRandom->Gaus(); })
.Define("pz", [](double px, double py) { return sqrt(px * px + py * py); }, {"px", "py"})
.Snapshot(treeName, fileName);
}
void df003_profiles()
{
gROOT->SetStyle("ATLAS");
auto fileName = "df003_profiles.root";
auto treeName = "myTree";
fill_tree(treeName, fileName);
ROOT::RDataFrame d(treeName, fileName, {"px", "py", "pz"});
auto hprofyx = d.Profile1D({"hprofyx", "Profile of py versus px", 64, -4, 4}, "py", "px");
auto hprofzx = d.Profile1D({"hprofzx", "Profile of pz versus px", 64, -4, 4}, "pz", "px");
auto hs = new THStack("hs",";px; py and pz");
hs->Add((TH1*)hprofyx->Clone());
hs->Add((TH1*)hprofzx->Clone());
auto c1 = new TCanvas("c1", "Profile histogram example");
hs->Draw("nostack hist C PLC");
auto fout = TFile::Open("profiles.root","recreate");
fout->cd();
hprofyx->Write();
hprofzx->Write();
}
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.26/02
Platform: CentOS 7
Compiler: GCC 9.3.0