Re: Can't set axis titles for graphs

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Thu, 18 Aug 2005 14:52:01 +0200 (MEST)


Hi Rafael,

See your macro modified below

Rene Brun

{
TCanvas *c1 = new TCanvas("c1");
c1->SetLeftMargin(0.18); //default is 0.1 (10 per cent) TFile* f = new TFile("scan_summary.root"); TTree* tree = (TTree*) f -> Get("T");

tree -> Draw("DeltaY:Poutre>>graph", "site == \"ALU\" && serialNumber == 1", "goff");

TH1* graph = (TH1*) gDirectory -> Get("graph");

graph -> Draw();

graph->GetXaxis()->SetTitle("Poutre (mm)");
graph->GetYaxis()->SetTitle("ML Distance (mm)");
graph->GetYaxis()->SetTitleOffset(2.0);  //default is 1

c1 -> Update();
}

On Thu, 18 Aug 2005, Rafael Arco Arredondo wrote:

> Hello,
>
> I'm having some problems setting the axis titles in a graph, after using
> the TTree::Draw member function with the '>>' option to save the
> contents into a graph (if I build the graph with
>
> TGraph* graph = new TGraph(items, tree -> GetV2(), tree -> GetV1());
>
> I do set the axis titles correctly.
>
> I attach one macro that shows the problem. The TTree the macro uses is
> rather big so I do not attach it, although you can find it
> at /afs/cern.ch/user/r/rarco/public/scan_summary.root (for people who
> have access to CERN's AFS).
>
> Thanks in advance,
>
> Rafa
>
>
Received on Thu Aug 18 2005 - 14:52:06 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:11 MET