Hi Selim, When drawing several histograms in the same pad, the range is defined by the axis parameters of the first drawn histogram and the axis titles shown are the ones of this first histogram. Any changes to the axis titles of the other histograms cannot be reflected to the picture. If this is not your problem, please send me a working macro and compiled code that reproduces this problem. I also assume you are using the version 2.23 Rene Brun Selim Issever wrote: > > Dear all, > > I seem to make something really stupid. I want to set the x- and y-axis title > of the most recent drawn histogram automatically; so I dont know the explicit > histogram name. This is my approach: > > ===== a macro ======================================== > { > if (gPad) { > TList *list = gPad->GetListOfPrimitives(); > TObject *obj = list->First(); > > while(obj) { > int cmpval = strncmp("TH", obj->ClassName(), 2); > if( !cmpval ) { > TH1 *hey = (TH1 *) obj; > hey->SetXTitle("aaa"); > hey->SetYTitle("bbb"); > } > obj = list->After(obj); > } > } > } > ===== end a macro ==================================== > > for some odd reasons the macro implementation works, but as soon as I copy the > above snippet into a function and compile it with my root application it > doesnt work: > > in my linkdef I've added the line: > #pragma link C++ function afunc; > > ===== afunc ========================================== > void afunc() { > if (gPad) { > TList *list = gPad->GetListOfPrimitives(); > TObject *obj = list->First(); > > while(obj) { > int cmpval = strncmp("TH", obj->ClassName(), 2); > if( !cmpval ) { > TH1 *hey = (TH1 *) obj; > hey->SetXTitle("aaaaa"); > hey->SetYTitle("bbbbb"); > } > obj = list->After(obj); > } > } > } > ============================================================= > > at the x axis nothing is displayed, at the y axis the string "aaaaa" is > displayed,.. > I seem to miss something,.. does anybody know, where the problem is? > > Thanks for your time! > Cheers, > Selim > > -- > Selim Issever | Tel: 040 8998-2843 +- "Unser Oertchen ist viel ---- > DESY-F15 | Fax: 040 8998-4033 +- aelter als euer Scheiss-Marl. > Notkestr. 85 | selim.issever@desy.de +------- Diplomand ------------ > 22603 Hamburg/Germany | http://www.physik.uni-dortmund.de/~issevers > << S M M + +: Your new mapping mud client @ http://smm.mudcenter.com >>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:16 MET