TH2F non-random binning?

I would like to know how to display a 2D histogram with polymarkers drawn in the bin center, rather than randomly positioned within the bin.


The number of random polymarkers drawn with SCAT option is proportional to the bin content. The greater the bin content is the darker the bin appears. Drawing only markers at the bin center poisition will tell you only if the bin is empty or not and so is a useless option. May be you should try other histogram representation like BOX or COL.

If your data are not in an histogram but in a tree or an ntuple then you will get a marker at the exact data point positions. But in that case the is not bins.

Whoa, cowboy!

FAR from useless, this is EXACTLY what I want. In my case, a cell will only have a value of zero or one—I want to know whether it has been filled. Furthermore, the X-axis will ONLY be an integer value (like isotope number, A, or detector number). In this case it is just plain meaningless to add some nonsensical random number.

BOX is not an option because that, too, suffers from the random silliness.

COL is close, but is still inappropriate because it does not allow you to overlay different plots in any meaningful manner. With different polymarkers, I could directly compare the results of different calculations/models. However the current implementation makes this impossible because you can’t tell where the points really are.

I can see the point of using a density-like display as described in certain cases, but why that should be the only option is beyond reasoning.

Maybe there is a better way in ROOT to plot what I want, or maybe ROOT is the wrong tool. If I export the data (NOT a projection) will I get back the bin number or the useless random number that was plotted?

BOX is not random at all ! the size of the box for each bein is proportional to the bin content

an other tought… May be the historgams are not the right way to store your data. may be simple arrays aor tress or ntuples will be much better …

I think you may be right about not using histograms. I already sort the interesting values from my tree (after some selection and calculation from meber values) into an array, so I’m basically only one step away from just writing that out to a file, or making a TPolyline from it. This may be the Right Way. Thanks.


Then a TGraph might be the representation you are looking for.


Ach! Yes! . Thanks Philippe, I just read through the TGraph section of the manual and this looks very much like what I want—putting each calculation in a separate TGraph, and bundling these into a TMultiGraph.

I’m still trying to learn ROOT (kicking and screaming, of course :wink:)
Thanks to all,