I am trying to use the “TTree::Draw” to produce an unbinned 3-d scatter-plot: {
gStyle->SetPalette(-1); // index 40->49 : basic colors
TNtuple *n = new TNtuple("n", "n", "x:y:z:color");
for (Int_t i = 0; i < 100000; i++) {
Float_t x, y, z, color;
gRandom->Rannor(x, y);
z = x*x + y*y;
if (z > 2.0) continue; // skip "too big" values
color = TMath::Ceil(4.0 * z + 0.5); // "basic colors" 1 ... 9
n->Fill(x, y, z, color);
}
n->Draw("x:y:z:(50 - color)");
}
I’ve got two problems:
- the colors that I get do NOT correspond to what I expect (well, I expect “basic colors” … 1 / “black”, 2 / “red”, 3 / “green”, …, 9 / “dark blue” to appear).
- I would like to define my own “frame” … for example, I would like to have axes " -2 < x < 2", “-3 < y < 3”, “-1 < z < 3” (well, I’d like to share the same “frame” between several such canvases / pads) -> how can I do this?
Thanks in advance,
Best regards,
Wile E.