hi,
Is it somehow possible to draw the bin content of TH3F histo with color coded (CONT) instead of the scatterplot?
thanks
greetings
doris
yes, using GL:
void gliso()
{
const Int_t nBin = 70;
const Double_t l = -40., r = 40.;
Double_t w = (r-l)/nBin;
TH3F *volume = new TH3F("V","V", nBin, l, r, nBin, l, r, nBin, l, r);
TCanvas *canvas = new TCanvas("glC","glC",600,600);
//Define and set user's palette,
const Int_t paletteSize = 5;
Float_t rgb[paletteSize * 3] =
{0.9f, 0.60f, 0.f,
0.f, 1.f, 1.f,
1.f, 0.f, 0.f,
0.f, 1.f, 0.f,
1.f, 1.f, 0.f};
Int_t palette[paletteSize] = {0};
for (Int_t i = 0; i < paletteSize; ++i)
palette[i] = TColor::GetColor(rgb[i * 3], rgb[i * 3 + 1], rgb[i * 3 + 2]);
gStyle->SetPalette(paletteSize, palette);
Float_t x,y,z;
for (x = l-w/2; x < r; x += w) {
for (y = l-w/2; y < r; y += w) {
for (z = l-w/2; z < r; z += w) {
if ( x*x + y*y + z*z < 500) volume->Fill(x,y,z,50);
if ( x*x + y*y + z*z < 300) volume->Fill(x,y,z,40);
if ( x*x + y*y + z*z < 200) volume->Fill(x,y,z,30);
if ( x*x + y*y + z*z < 80) volume->Fill(x,y,z,20);
if ( x*x + y*y + z*z < 30) volume->Fill(x,y,z,10);
}
}
}
volume->SetContour(5);
volume->Draw("gliso");
}
this doesn’t work for me.
I fill a TH3F with x,y,z coordinates and the weight (which presents the temperature at this point) in batch mode. I try to plot 3d with colored weight.
i tried with:
TCanvas *canvas = new TCanvas(“glC”,“glC”,600,600);
histo3dmean->Draw(“GLLEGO2”); // only as a try how i looks like
this hisogram is then drawn into a root file.
when I open the root file (TBrowser) and try to open the histrogram, I get the errormessages:
Error in TGLHistPainter::DistancetoPrimitive: Attempt to use TGLHistPainter, while the current pad (gPad) does not support gl
what is wrong?
or is there another method for this?
Can you send a small running example showing what you are doing ?