Hi Kate, Both problems are fixed now in the CVS version. There was a special scale in log scale when the maximum is less than 1. Rene Brun On Mon, 4 Nov 2002, Kate Scholberg wrote: > > > > > > 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); > > > > //adchithist2->GetYaxis()->SetRange(0.01,10.); > > adchithist2->SetMinimum(0.01); > > adchithist2->SetMaximum(10); > > adchithist2->Draw(); > > adchithist2->Print("all"); > > > OK, this works. But wouldn't it be a more sensible default behavior > to have the axis range automatically set correctly for a log plot? > Shouldn't the histograms know what their minimum and maximum (nonzero) values > are? Is there a good reason why this doesn't work automatically? > > But leaving that aside for the moment, I have another log scale plot > with a scaled histogram that isn't plotting correctly. The simple > macro example is attached. Root 3.03/06 works but Root 3.03/08 and > beyond (including the latest version from the cvs repository) just > plot nothing at all, although it seems to choose a reasonable y-axis > (in all cases RH Linux 7.3). It seems to matter what the value used > for scaling actually is. A bug? > > Kate Scholberg > schol@mit.edu > > > ------------------------------------------------------------ > > void Scaled_hist() > { > > TCanvas *c2 = new TCanvas("c2","TRD hit dE"); > c2->SetLogy(1); > c2->SetFillColor(10); > > gStyle->SetOptStat(0); > > Int_t nbin = 200; > Float_t firstbin = 0.; > Float_t lastbin = 200.; > > TH1F *detrd = new TH1F("detrd","dE from TRD",nbin,firstbin,lastbin); > > Float_t sum=0.; > > for(int i=0;i<1000;i++){ > sum = Float_t(gRandom->Gaus(0,20)); > detrd->Fill(sum); > } > > detrd->Scale(1./50.); > > detrd->SetMarkerColor(2); > detrd->SetMarkerStyle(22); > > detrd->Draw("p"); > } > > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET