TH3F with glcolz option

test.C (249 Bytes)
file.root (32.6 KB)

Hi, I have a TH3F histogram and I cannot draw it with the glcolz option. I have attached the script and the root file, as well as the image produced. Using a transfer function for making empty bins transparent does not help. I would be very grateful for any suggestions on how to draw this histogram.

Thank you,

_ROOT Version: ROOT 6.10/08
_Platform: macosx64
_Compiler: c++/4.2.1, Apple LLVM version 9.1.0 (clang-902.0.39.2)

thanks. I will look. Does it work with other 3D options like BOX ?

Your historgam puts ROOT is a strange state. When I draw it with the option BOX only (no opengl) the view is blocked. I cannot rotate it. I see also some red line (coming from the list of functions I guess)


Thank you for your reply. The glbox option works, but there is no colour palette info.

Best regards,


The following works:

  TFile* file = new TFile("file.root","READ");

  TH3F* hist = (TH3F*) file->Get("hist");

  hist->Draw("box2 Z  ");

I guess the red line is the function liked to the TH3

It was produced with a script analysing a huge ASCII file, and which has drawn the histogram following the use of the transfer_function which made the empty bins transparent. Then I wrote the 3D histogram to a another root file, so I can open it directly, without reading the huge ASCII file again. But it had already used the transfer function method which I got from post

may be @tpochep may have an idea.

Hello again,

I attached two scripts to illustrate how using the transfer function prior to writing the histogram to the file causes this behaviour.

So I now know not to use the transfer function until the very end, prior to the final drawing.

Thank you for looking into this,


DoItThisWay.C (1.05 KB)

DontDoItThisWay.C (1.28 KB)

file.root (31.3 KB)

the root file you sent does not contain the hist histogram:

$ rootls file.root

I cannot use rootls:

Cristians-iMac:Downloads cristian$ rootls file.root

Traceback (most recent call last):

File “/Users/cristian/root/bin/rootls”, line 10, in

import cmdLineUtils

ImportError: No module named cmdLineUtils

Cristians-iMac:Downloads cristian$

but if I check:

Cristians-iMac:Downloads cristian$ root file.root


[...] $ rootls -l file.root 
TH3F  Jul 05 10:05 2018 hist  "3D"

You are right … I must have had an other file.root. (I have many file.root, test.root, etc … downloaded from this forum :frowning:

yes the macro “DoItThisWay.C” works fine.

Sorry for the confusion caused by naming it file.root. But I bet I am the first one with DoItThisWay.C and DontDoItThisWay.C :grinning:

Yes you are :slight_smile: and that’s all my fault I should have been more careful… sorry again …

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.