// the sigmaMap histogram has 3600x1500 bins and contains both positive // and negative "z" values void tryme() { TFile *f1 = new TFile("sigmaMap.root","READ"); TH2F *sigmaMap = (TH2F *)f1->Get("sigmaMap"); sigmaMap->SetTitle(""); gStyle->SetOptStat(kFALSE); TCanvas *c1 = new TCanvas("c1","",800,600); c1->ToggleEventStatus(); c1->SetRightMargin(0.2); c1->SetLeftMargin(0.01); c1->SetTopMargin(0.01); c1->SetBottomMargin(0.01); cout << "sig map " << sigmaMap->GetArray() << endl; cout << "bins x " << sigmaMap->GetNbinsX() << endl; cout << "bins y " << sigmaMap->GetNbinsY() << endl; cout << "gHist " << gHistImagePalette << endl; TImage *img = TImage::Create(); // code crashes on the next line img->SetImage((const Double_t *)sigmaMap->GetArray(),sigmaMap->GetNbinsX()+2,sigmaMap->GetNbinsY()+2,gHistImagePalette); img->Draw(); img->StartPaletteEditor(); }