Hi, Rooters, I've made a macro which is a simple rebin, but all the bins have different colour. B1(Int_t Minn, Int_t Maxx, Int_t Z){ TH2D** G = new TH2D*[Z]; TFile* File = new TFile("Root.root"); TCanvas* C = new TCanvas("C"); TH2D* K = File->Get("h3"); int Unit = (Int_t)ceil((Maxx - Minn)/Z); char CTemp[128]; for(Int_t i = 0; i < Z; i++){ sprintf(CTemp, "G[%i]", i); G[i] = new TH2D(CTemp, CTemp, K->GetNbinsY(), 1, K->GetNbinsY(), Z, 1, Z); G[i]->SetLineColor(i + 1); } for(int i = 1; i <= K->GetNbinsX(); i++) for(int j = 1; j <= K->GetNbinsY(); j++) if(K->GetBinContent(i, j) > Minn){ int Temp = (Int_t)K->GetBinContent(i, j)/Unit; if(Temp < Z) G[Temp]-> Fill(j, Temp); } int m = G[0]->GetMaximum(); int p = 0; for(int z = 1; z < Z; z++){ if(G[z]->GetMaximum() > m){ m = G[z]->GetMaximum(); p = z; } } G[p]->Draw("LEGO1"); G[p]->GetYaxis()->SetLimits(Minn, Maxx); for(Int_t i = 0; i < Z; i++){ G[i]->GetYaxis()->SetLimits(Minn, Maxx); G[i]->Draw("LEGO1SAME"); } } The result is nice enougth, but it seams that most of the bins wouldn't be in the "box", but always at the "other end" of the box ... How can I make a picture like that ( "normal" LEGO with different colors )? k.
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET