Hi, I am trying to do the following: (1) Take an existing graph (2) Set the x and y axis limits outside the data range (3) SetNdivisions (4) SetGridy (5) Set axis titles I cannot make this work to my satisfaction. I can get the axis ranges right with a call to TCanvas::DrawFrame. However, I cannot seem to get the axis titles to draw in this case. I do get gridlines, but calling SetNdivisions doesn't seem to allow me to modify them. If I don't call TCanvas::DrawFrame then the x axis cannot be scaled as desired with calls to TAxis::SetRangeUser or TAxis::SetRange. (Why?). I can scale the y axis with TGraph::SetMaximum and TGraph::SetMinimum (but why not TAxis::SetRangeUser?) in this case. Am I going about this all wrong? Here is my macro: { double msize=0.8; Axis_t xlow=0.5; Axis_t xhigh=3.5; Axis_t ylow=0.15; Axis_t yhigh=0.65; // electrons TCanvas* c_e_sep_resolution = new TCanvas("c_e_sep_resolution", "Electron Resolution"); c_e_sep_resolution->DrawFrame(xlow,ylow,xhigh,yhigh); g_e_resolution->SetMarkerColor(kGreen); g_e_resolution->SetMarkerStyle(8); g_e_resolution->SetMarkerSize(msize); g_e_resolution->Draw("p"); //g_e_resolution->SetMinimum(ylow); //g_e_resolution->SetMaximum(yhigh); //g_e_resolution->GetXaxis()->SetRangeUser(xlow, xhigh); g_e_resolution->GetHistogram()->SetTitle(""); g_e_resolution->GetXaxis()->SetTitle("#sqrt{ E } (GeV^{1/2})"); g_e_resolution->GetYaxis()->SetTitle("#frac{ #sigma }{ #mu }#sqrt{ E }"); g_e_resolution->GetYaxis()->SetTitleSize(0.05); g_e_resolution->GetYaxis()->SetNdivisions(520); c_e_sep_resolution->SetGridy(); gPad->Modified(); // end electrons } I use root 3.03/02 on a linux machine with the egcs compiler. Mike Kordosky -- Graduate Research Assistant // High Energy Physics Lab kordosky@hep.utexas.edu // University of Texas at Austin kordosky@fnal.gov // ph: (512) 471-8426 (RLM Lab, Office) (512) 475-8673 (ENS Lab)
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:17 MET