Hi
I am trying to assign calibration value to my axis on a 2D plot when plotting a TH2F.
I get the following error:
[color=red]Error in TCanvas::Range: illegal world coordinates range: x1=0.000000, y1=-312.500005, x2=0.000000, y2=312.500005
Error in TCanvas::RangeAxis: illegal axis coordinates range: xmin=0.000000, ymin=-250.000000, xmax=0.000000, ymax=250.000000[/color]
when I do the following operation
Hist->GetXaxis()->Set(4096,pXarrayEnergy); //Contains the calibration of my X axis
Am I miss-interpreting the usage of the Set function from TAxis?
Looking at the documentation, and as a note to my example, the following does work:
low_x=0;
max_x=2048;
Hist->GetXaxis()->Set(4096,low_x, max_x);
Thanks for your inputs…
Kris
-----This is my code relevant
[color=green]
double pXarrayEnergy[CAPACITY2DMAX];
double pYarrayTime[CAPACITY2DMAX];
//Initializes the monster: A 2D array
t_data *pData2DArray[CAPACITY2DMAX];
for(int i=0;i<CAPACITY2DMAX;i++)
pData2DArray[i]=new t_data[CAPACITY2DMAX];
//pXarrayEnergy and pYarrayTime assing here… not included here
// Create Histogram
TH2F *Hist = new TH2F(“Hist”, “Test Contour”, 4096,0,4096, 4096,0,4096);
[/color]
[color=red]//The following generates an error[/color][color=green]
Hist->GetXaxis()->Set(4096,pXarrayEnergy); //Contains the calibration of my X axis
Hist->GetYaxis()->Set(4096,pYarrayTime); //Contains the calibration of my X axis
// Load Histogram Data
for (Int_t i = 0; i < 4096; i++)
for(Int_t j = 0; j < 4096; j++){
Hist->SetBinContent(i,j, (int)pData2DArray[i][j]);
}
gStyle->SetPalette(1);
Hist->SetStats(kFALSE);
Hist->Draw(“COLZ”);[/color]