Help with removing the graph title

dear root users,
i’m a physics student and while i’m not completely new to root, i just run into a problem that i cannot solve. i’m trying to write a script to plot a graph and then save it as a .eps file. the problem lies in the fact that when i create a canvas, the “options->histogram title” option is automatically switched on but i would like to switch it off. till this moment i have always done that manually since i had to print out 3 or 4 plots…

below is the script i’m using:

{
gROOT->Reset();

ifstream             in1; 

Int_t                Nrint = 400;
Int_t                Nrpts = Nrint + 1;
Int_t                i;

Double_t             xmin, xmax;
Double_t             x[Nrpts], y[Nrpts];


/* open the DATA file */
in1.open("mydata.dat");

i = 0;

/* read the data from the file */
while(1)
{
in1  >> x[i] >> y[i];
if (!in1.good()) break;
i++;
}

/* definition of the graph */
TGraph *gr = new TGraph(Nrpts,x,y);

/* canvas definition & initialization */
TCanvas *canv = new TCanvas("canv","Canvas Name",200,50,800,600);

canv->Clear();
canv->SetFillColor(10);
canv->SetBorderMode(0);
canv->SetRightMargin(0.01);
canv->SetTopMargin(0.01);

/* setting some graph parameters */
gr->SetTitle("RANDOM TITLE");

/* plotting the graph */
gr->Draw("AL");

/* switch to the just created canvas */
canv->cd();

/* plotting range */
xmin=0.0;
xmax=1.0;
(gr->GetXaxis())->SetRangeUser(xmin,xmax);

/* axis names */
(gr->GetXaxis())->SetTitle("x");
(gr->GetYaxis())->SetTitle("T(x,0)");

canv->Update();

canv->Print("~/somedir/myfile.eps");

in1.close();

}

does anyone have an idea on what to add to the script to switch off the “histogram title”?

gr->SetTitle("");

Rene

1 Like

THANKS!!!