I am creating a canvas with four pads, any combination of them will contain a two dimensional graph. If the macro is run live, the canvas is drawn and displays the formats that I specify. However, those formats are not saved to file using SaveAs(), nor are they saved if from the Canvas I do a menu “Save As”.
I’m using Root 5.34.
Thanks,
Rob
void main()
{
TCanvas *c1 = new TCanvas("c1","Radiative Acceptance",70,60,1200,900);
c1 -> Divide(2,2);
c1 -> cd(1);
g1 -> Draw("surf1");
SetupAxesg( g1, "Radiative Acceptance", "Minimum Positron Energy [MeV]","Minimum Photon Energy [MeV]","Acceptance");
c1_1 -> SetTheta(30);
c1_1 -> SetPhi(210);
c1_1 -> Modified();
c1_1 -> Update();
}
void SetupAxesg( TH2D *gr, char *mainTitle, char *xtitle,char *ytitle,char *ztitle);
{
gPad -> Update();
gr -> SetTitle(mainTitle);
gr -> GetXaxis() -> SetTitle(xtitle);
gr -> GetXaxis() -> SetTitleSize(0.03);
gr -> GetXaxis() -> SetLabelSize(0.02);
gr -> GetXaxis() -> SetDecimals(kTRUE);
gr -> GetXaxis() -> CenterTitle(true);
gr -> GetXaxis() -> SetTitleOffset(1.30);
gr -> GetYaxis() -> SetDecimals(kTRUE);
gr -> GetYaxis() -> SetTitle(ytitle);
gr -> GetYaxis() -> SetTitleSize(0.03);
gr -> GetYaxis() -> SetLabelSize(0.02);
gr -> GetYaxis() -> CenterTitle(true);
gr -> GetYaxis() -> SetTitleOffset(1.30);
gr -> GetZaxis() -> SetDecimals(kTRUE);
gr -> GetZaxis() -> SetTitle(ztitle);
gr -> GetZaxis() -> SetTitleSize(0.03);
gr -> GetZaxis() -> SetLabelSize(0.02);
gr -> GetZaxis() -> CenterTitle(true);
gr -> GetZaxis() -> SetTitleOffset(1.30);
}
I had to modify your macro to make it work (many errors with ROOT 6). rob.C (1.7 KB)
But still it does not work. Some arrays are undefined:
$ root rob.C
------------------------------------------------------------------
| Welcome to ROOT 6.19/01 https://root.cern |
| (c) 1995-2019, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Aug 21 2019, 13:02:06 |
| From heads/master@v6-19-01-881-g2f5fb7eaf6 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0]
Processing rob.C...
In file included from input_line_12:1:
/Users/couet/roottest/rob.C:36:27: error: use of undeclared identifier 'rX0'
double xx = Emax*rX0[i];
^
/Users/couet/roottest/rob.C:39:35: error: use of undeclared identifier 'rY0'
double yy = Emax*rY0[j];
^
root [1]