2d histopgram


I have 2 questions:
I have a 2d histogram. I want give a color, say “blue”, to the points that satisfy some condition and some other color to other points.

I want to plot a 2d scater plot, TGraph2D, but instead of points I want to show bar. I tried wtih

but it did not work.

Could you give me some idea.


  1. A 2D histogram plotted as a scatter plot has only one color. If you have 2 data sets (2 conditions) define 2 histograms and use option SAME

  2. TGraph2D doesn’t have the “Bar” option. Anyway, what kind of plot do you expect with that option applied on TGraph2D ?

gr = new TGraph2D(n,x,y,z);

Ok, it puts a marker. But I want to put a vertical bar at the position of the marker. The height of the bar should show the value of the z-coordinate for the corresponding value of x and y.

Is it possible to do this?

Thanks a lot for your help.


For the time being you can use the option LEGO which will smooth the data set using Delaunay triangulation, generate an histogram, and plot it with option LEGO. The only way to draw a TGraph2D without smotthing is the option P or P0.