Sebastien, I thought that the answer to your question was obvious. Colors, line width, fill style, etc are a property of each individual object. Lin/log scale is a property of the pad containing the objects. It would not make much sense to have in the same pad an histogram drawn with a log scale (x and/or y) and another histogram with a linear scale. In the original Hbook package, there was an option to set a lin/log scale for an histogram. This was OK at a time where histograms were "printed" on a line-printer one by one in a serial way. It is not appropriate to a system supporting multiple objects in the same container. Rene Brun On Wed, 24 Apr 2002, Sebastien Greder wrote: > Hello Rene, > > Excuse me I couldn't reply directly last week about this. > I don't agree with you, especially if you don't tell me why it was a > mistake in PAW, I think that both features should be available. > ===> Could you explain me why colors, titles, etc ... are then > necessary histograms' properties ?? > > cheers, > > sebastien. > > > On Fri, 19 Apr 2002, Rene Brun wrote: > > > Hi Sebastien, > > > > The lin/log scale is not a property of the histogram. I know that > > we had this feature in PAW and it was a mistake. > > Lin/Log scale is a property of the pad. > > > You can toggle between lin/log scale after having drawn your histogram. > > In the same way, you can change the object attributes after having drawn the > > object Unlike in PAW where you had to repeat the complete set > > of commands). > > > > Note that when drawing ntuples in a pad with a log x scale, TTree::Draw > > will conveniently create a histogram with bins "linear in a log scale" > > > > Rene Brun > > > > > > > > > > Sebastien Greder wrote: > > > > > > Hello Rooters, > > > > > > I was just wondering about TH1 objects ; usually when I want to plot > > > an/several histo(s) and/or save it(them),the different steps look like: > > > > > > - create my histo > > > - fill it > > > - give some attributes settings (color, marker style and so on) > > > - draw or histo->Write() > > > > > > If I want my histo(s) to have a log scale (x or y), I have to act on the > > > corresponding pad through the SetLogX method. So this operation can only > > > be done once the histo has been drawn or saved. > > > > > > Since I'm a lazy guy, I usually write some macros to plot/save several > > > histos like : > > > > > > void Plot_ps(TH1* hist1, Char_t* title = "", Char_t* option = "", > > > Bool_t logy = 0, Bool_t logx = 0, Bool_t fit = 0, > > > Int_t stati = 111111, Bool_t wait = 0, etc .....) > > > { > > > TCanvas *c1 = (TCanvas*)gROOT->FindObject("c1"); > > > if (c1) {c1->Clear();} > > > else { > > > style(); > > > c1 = (TCanvas*)gROOT->FindObject("c1"); > > > } > > > > > > TPad* pad1 = new TPad("pad1","pad",0.03,0.03,0.98,0.98); > > > pad1->Draw(); > > > if (logy) pad1->SetLogy(); if (logx) pad1->SetLogx(); > > > > > > pad1->cd(); > > > hist1->SetFillColor(5); > > > hist1->SetEverythingIwantToDoToHaveANiceHisto(); > > > > > > if (fit) hist1->Fit("gaus"); > > > hist1->GetXaxis()->SetTitleSize(0.05); > > > hist1->Draw(option); > > > > > > // l'histo est memorise > > > c1->Update(); > > > } > > > > > > but it's not always a convenient situation. > > > In fact there are a lot of things that can be set in before "validating" > > > a histo (about ~40 "Set..." methods dealing with content,axis > > > range,colors, etc ...) so why not SetLogX/Y ? > > > It should be nice to have this possibility in TH1 or in TAxis (so that a > > > histo->GetXAxis()->SetLogX() could be done). > > > > > > Or did I miss something and this operation is already available ?? > > > > > > Cheers, > > > > > > sebastien. > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET