How to plot a TH3D histogram and a TGraph2D graph together

Hello,
I am plotting a TH3D histogram (using drawing option: “glcolz”) on a canvas, and then try to draw a TGraph2D graph on the same canvas, but I cannot. Any one can give me a hint why the 2nd graph cannot be drawn on the same canvas? Any solution?

The test files are attached.

Cheers,
Zhiyi.
test.root (149 KB)
test_plotting.C (468 Bytes)

[quote=“zhiyiliu”]Hello,
I am plotting a TH3D histogram (using drawing option: “glcolz”) on a canvas, and then try to draw a TGraph2D graph on the same canvas, but I cannot. Any one can give me a hint why the 2nd graph cannot be drawn on the same canvas? Any solution?

The test files are attached.

Cheers,
Zhiyi.[/quote]

Hello. “same” option is not implemented for gl at the moment.

Thanks for telling this.

I wrote a ‘dirty’ code doing some tricks to realize this task. The working code is attached.

As I saw from previous posts, ‘gl’ option was really slow. Now it is still slow, I assume no improvements on working out a real ‘gl’ yet?

Cheers,
Zhiyi.
test_plotting.C (1.92 KB)

[quote=“zhiyiliu”]Thanks for telling this.

I wrote a ‘dirty’ code doing some tricks to realize this task. The working code is attached.

As I saw from previous posts, ‘gl’ option was really slow. Now it is still slow, I assume no improvements on working out a real ‘gl’ yet?

Cheers,
Zhiyi.[/quote]

What is ‘real ‘gl’’? You have 287432 bins, each bin is painted as a box (for each box only top, bottom and two front-side polygons are drawn). So it’s slow to draw 287432 * 4 quads on your machine with color and transparency (alpha-blending).
But I’ll check what can be improved.

I found your reply to the post:

which mentioned something ‘real’ gl pad.

Another puzzle: I cannot print my canvas in batch (the printed picture is empty), I am curious why?

Thanks for this. If boxes are totally transparent, we may not need to plot all those boxes and may significantly improve speed in some case.

[quote]So it’s slow to draw 287432 * 4 quads on your machine with color and transparency (alpha-blending).
But I’ll check what can be improved.[/quote]

[quote=“zhiyiliu”]Thanks for this. If boxes are totally transparent, we may not need to plot all those boxes and may significantly improve speed in some case.
[/quote]

Yes, that’s right, I can skip boxes, which are less than, say, 1% opaque.

Appreciate if you could tell once you have implemented this into the trunk.

[quote]
Yes, that’s right, I can skip boxes, which are less than, say, 1% opaque.[/quote]

[quote=“zhiyiliu”]Appreciate if you could tell once you have implemented this into the trunk.

[quote]
Yes, that’s right, I can skip boxes, which are less than, say, 1% opaque.[/quote][/quote]

Hi. It’s in the trunk.

Great! This addition saves tons of time in my case, thank you!