Hello,
How to force root to draw tickmarks and labels on X - axis
in root 2.24/02?
Thank you and regards.
Michal Lijowski
{
TCanvas *cc1 = new TCanvas("cc1", "My Canvas", 600, 800);
gStyle -> SetLabelOffset(0.00001, "X");
// cc1 -> SetBottomMargin(0.15);
cc1 -> SetLeftMargin(0.15);
cc1 -> SetTicks();
cc1 -> SetLogx();
cc1 -> SetLogy();
// define plot ranges with histogram class
Float_t xxmin = 100.0;
Float_t xxmax = 150.0;
Float_t yymin = 1.0E-9;
Float_t yymax = 2.0E-6;
TH2F *HH = new TH2F("HH", "Axis Test", 2, xxmin, xxmax, 2, yymin, yymax);
printf(" NDiv %d\n", HH -> GetXaxis() -> GetNdivisions());
HH -> GetXaxis() -> SetNdivisions(-100);
printf(" NDiv %d\n", HH -> GetXaxis() -> GetNdivisions());
Float_t LabelSize = 0.03;
HH -> GetXaxis() -> SetLabelOffset(-0.02);
HH -> GetXaxis() -> SetLabelSize(LabelSize);
HH -> Draw();
printf(" Label offset %9.3E\n", gStyle -> GetLabelOffset("X"));
TText *xlabel = new TText();
xlabel -> SetTextFont(62);
xlabel -> SetTextColor(1);
xlabel -> SetTextSize(0.05);
xlabel -> SetTextAlign(22);
xlabel -> SetTextAngle(0);
TLatex *ylabel = new TLatex();
ylabel -> SetTextFont(62);
ylabel -> SetTextColor(1);
ylabel -> SetTextSize(0.05);
ylabel -> SetTextAlign(22);
ylabel -> SetTextAngle(90);
Char_t tmpstr[60];
sprintf(tmpstr, "Kinetic Energy (MeV/nucleon)");
xlabel-> SetNDC();
xlabel -> DrawText(0.50, 0.033, tmpstr);
sprintf(tmpstr, "Flux (particles/(cm^{2}-sr-s-MeV/nucleon))");
ylabel-> SetNDC();
ylabel -> DrawLatex(0.03, 0.50, tmpstr);
cc1 -> Update();
}
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET