Hi,
I have two parameters I would like to plot against each other in a 2D map.
The x-axis consists of 7 values and the z-axis consists of 5 values.
x = -4, -2, 0, 6 and 12.
z = -3, -2, -1, 0, 1, 2, 3
But instead of measuring 35 values, I only have 29.
However, when I fill the map it looks like a higher binning then it should, for example x=2 was never measured but it appears as it would have.
Furthermore, how can I ensure that “a binning is filled centered with the corresponding axis values”? In other words: x=-2, z=0 looks fine, but x=-4, z=0 does not. Also x=-4, z=-2 not. And so on.
{
TCanvas *c = new TCanvas("c","Graph2D example",0,0,700,700);
TGraph2D *dt = new TGraph2D();
dt->SetTitle("APD ratio map; z / mm; x / mm; ");
Double_t x[29]={-4, -4, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12};
Double_t z[29]={-1, 1, -2, -1, 0, 1, 2, -3, -2, -1, 0, 1, 2, 3, -3, -2, -1, 0, 1, 2, 3, -3, -2, -1, 0, 1, 2, 3};
Double_t ratio[29]={(1.1994), (1.36), (1.0446),
(1.0223), (1.1799), (1.316), (1.227), (0.9449),
(1.1245), (1.0256), (1.032), (0.97), (1.0338), (1.02), (1.086),
(1.052), (1.08), (1.065), (1.05), (1.0681), (1.05), (1.0475),
(0.987), (1.13036), (1.0235), (1.38), (1.071), (1.096), (1.07)};
for(Int_t N=0; N<29; N++){
Double_t ratio_x = x[N];
Double_t radius = z[N];
Double_t degree = ratio[N];
dt->SetPoint(N, radius, ratio_x, degree);
}
dt->GetXaxis()->SetRangeUser(-1,13);
dt->GetYaxis()->SetRangeUser(-4,4);
dt->GetZaxis()->SetLabelOffset(1.8);
dt->SetNpx(7);
dt->SetNpy(5);
gStyle->SetPalette(1);
dt->Draw("colz");
}