I found a solution but it is not very nice...
{
TFile *f=TFile::Open("hsimple.root");
TTree *ntuple = (TTree*)f->Get("ntuple");
TCanvas *c1 = new TCanvas();
c1->SetLogy();
ntuple->Draw("pz:px>>h2(50,-3,3,50,1e-2,20)","","");
TH2 *h2 = (TH2*)gDirectory->Get("h2");
TGraph *graph = (TGraph*)gPad->GetPrimitive("Graph");
graph->GetYaxis()->SetTitle("Y title");
graph->GetXaxis()->SetTitle("X title");
TCanvas *c2 = new TCanvas();
graph->Draw("ap");
c2->SetLogy(); h2->SetMaximum(0); h2->Draw("sames");
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Luca Grandi
Sent: Wednesday, March 12, 2008 6:00 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system)
Subject: [ROOT] help axis
Dear Rooties,
I am using the code below to plot a scatter plot on semi-logarithmic scale and, at the same time, to be able to plot the Stats.
I have tried different solutions but I am unable to write the title on the axis of the scatter plot.
Could you help me?
Thanks
Luca
{
TFile *f=TFile::Open("hsimple.root");
TTree *ntuple = (TTree*)f->Get("ntuple");
TCanvas *c1 = new TCanvas();
c1->SetLogy();
ntuple->Draw("pz:px>>h2(50,-3,3,50,1e-2,20)","","");
TH2 *h2 = (TH2*)gDirectory->Get("h2");
h2->SetMaximum(0);
h2->Draw("sames");
}
Received on Wed Mar 12 2008 - 18:53:23 CET
This archive was generated by hypermail 2.2.0 : Thu Mar 13 2008 - 17:50:02 CET