Sorry, it seems that ROOT 5 has real problems with g->Draw("surf3"); (maybe because this graph has 150x175 points on a “regular rectangular grid”). Maybe @couet knows any trick to get it working with ROOT 5 (not even “colz” works well but I think it begins with the problem that g->GetHistogram() takes ages to complete so I suspect that it’s a “known problem” with the Delaunay triangles).
@Sandy Can you possibly move to ROOT 6.20/04?
If you cannot, I’m afraid that you may need to stay with a TH2, e.g.:
{
// "data.txt" contains a 150x175 "regular rectangular grid" (26250 points)
TH2D *h = new TH2D("h", "some Thing;some X;some Y;some Z",
150, 0., 300., 175, 0., 350.);
TGraph2D *g = new TGraph2D("data.txt");
h->FillN(g->GetN(), g->GetX(), g->GetY(), g->GetZ());
delete g; // no longer needed
h->Sumw2(kFALSE); // make sure "bin_error = sqrt(bin_content)"
h->ResetStats(); // reset the statistics including the number of entries
h->GetXaxis()->SetRangeUser(50., 200.);
h->GetYaxis()->SetRangeUser(80., 280.);
gStyle->SetOptStat("neMRiuo"); // underflows and overflows respect ranges
h->Draw("surf3");
}
@couet There is also another problem that I found. According to the “How to set ranges on axis?”, one should be able to use TAxis::SetLimits BEFORE the graph is drawn. This does not work here at all. I needed the following (note: no “pcol” at all so it’s another problem):
g->Draw("surf3"); // it MUST be drawn first
gPad->Modified(); gPad->Update(); // one MUST make sure it's really (re)drawn
g->GetXaxis()->SetLimits(50., 200.); // now one can change it
gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn
I could plot before also and now with your way too. But, I have query about fit. Let me try to make you understand about my query with an already set example in root website.
@couet Like the attached figure…is there any way to change palette in such a way that one of the abode two fits would look like this and another fit would be of another colour but again transparent
Any idea on plotting TH2 drawn with option E and the fit surface drawn
in the same canvas but having transparent color (shown in the figure
attached before).
@couet And there’s another bug … the markers are shifted with respect to the function if one uses (due to differences in axes ranges between the graph and the function?):
(1) I have seen only surf4 option works if somebody wants not to have net like surface. But, still what I am seeing that those fit surfaces can’t be made transparent.
(2) If there are more than one fits then without transparent 2D surfaces, it will not be understandable.
@Sandy@Wile_E_Coyote thank for the recap.
Can you post the latest instance of the macro you ended up ?
That will avoid me to take pieces here and there …