Hi Kate, I have modified your script to set the min/max on the Y axis, see below. I am also proposing a much simpler version. Rene Brun //first version: your script slightly modified void test_logscale(){ TCanvas *c1 = new TCanvas("c1","TRD hit dE"); TFile *my1 = new TFile("test_logscale.root"); my1->ls(); c1->SetLogy(); adchithist->Print("all"); TH1F* adchithist2 = new TH1F; adchithist2 = adchithist; adchithist2->Add(adchithist2,adchithist,0.,0.01); //adchithist2->GetYaxis()->SetRange(0.01,10.); adchithist2->SetMinimum(0.01); adchithist2->SetMaximum(10); adchithist2->Draw(); adchithist2->Print("all"); } //the simplified version void test_logscale(){ TCanvas *c1 = new TCanvas("c1","TRD hit dE"); TFile *my1 = new TFile("test_logscale.root"); c1->SetLogy(); adchithist->Scale(0.01); adchithist->SetMinimum(0.01); adchithist->SetMaximum(10); adchithist->Draw(); } On Fri, 25 Oct 2002, Kate Scholberg wrote: > Hi, > > I suspect this is a simple problem. I'm just trying to Draw a simple > 1D histogram with a log scale, and I'm having trouble getting a > sensible default range of values on the y-axis from the Draw method. I > also don't seem to able to set the axis range by hand with e.g. > > hist->GetYaxis()->SetRange(min,max); > > My test script and histo file: http://www-lns.mit.edu/~schol/roottest > (Root 3.03/06, Linux) > > In this simple example, the histo is filled with values ranging from > 0.01 to a few tens, but TH1F::Draw starts the y-axis at ~0.2. Is this > the expected behavior? If so, is there an easy way to set the y range > by hand? Do I have to make a new TAxis or something? > > Kate Scholberg > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:15 MET