If you are plotting previously made histograms you have to follow your gStyle commands with gROOT->ForceStyle(); Art lijowski@cosray2.wustl.edu wrote: > Hello Rooters, > > Is gStyle -> SetHistLineWidth() supposed to change a histogram line > width in the Postscript output? The following macro reads histograms > from the hsimple.root file and the Postscript output is the same whether > I use gStyle -> SetHistLineWidth(1) or gStyle -> SetHistLineWidth(10). > I have been using root 2.23/12 under SunOS5.7. > > Thank you and best regards, > > Michal Lijowski > > void test_hist() > > { > gROOT -> Reset(); > gROOT -> SetStyle("Plain"); > gStyle -> SetHistLineWidth(1); > // open input file > Char_t infile[100]; > sprintf(infile, "/data1/cern/root/tutorials/hsimple.root"); > TFile *f1 = (TFile*)gROOT->GetListOfFiles()->FindObject(infile); > if (!f1) { > f1 = new TFile(infile); > } > > cout << " hist line width " << gStyle -> GetHistLineWidth() << endl; > > TH1F *HH[10]; > TCanvas *CVS[10]; > gDirectory -> ls(); > gDirectory -> pwd(); > Char_t ctitle[40], cname[40]; > Char_t infile[200], outps[30]; > // create an iterator to loop through all objects(keys) in the directory > Int_t ii = 0; > TIter nextkey(gDirectory -> GetListOfKeys()); > TObject *obj; > TKey *key; > while (key = (TKey*)nextkey()) { > key -> Print(); > obj = key -> ReadObj(); //use ReadObj, not Read > > if (obj->InheritsFrom("TH1") ) { //instead of obj->IsA > HH[ii] = (TH1F *) obj; > cout << " " << HH[ii] -> GetTitle() << endl; > sprintf(cname, "myCVS%02d", ii); > sprintf(ctitle, "Canvas %02d", ii); > CVS[ii] = new TCanvas(cname, ctitle, 800, 600); > gPad -> SetTicks(); > HH[ii] -> DrawCopy(); > CVS[ii] -> Update(); > sprintf(outps, "%s.ps", cname); > CVS[ii] -> SaveAs(outps); > ii++; > } > } > }
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET