0-values are not at 0-axis

Hello Rooters,

I observe a very strange behavior of a 2dim histogram that is filled with two arrays where the values in the y-array are all zero. Although they are zero the markers are not exactly on the y=0 axis.
This strange behaviour disappears when I use more bins for the y axis (300 bins upwards).
Why is that?
I attached the piece of code I was using.

Thanks for a reply!

void teste(){
float y[5] = {0,0,0,0,0};
float x[5] = {1,2,3,4,5};
TH2F *h2 = new TH2F(“h2”,“h2”,8,0,8,100,0,1); //markers are not at y=0 axis
//TH2F *h2 = new TH2F(“h2”,“h2”,8,0,8,500,0,1); //markers ARE nice at y=0 axis
for(i=0;i<=4;i++) {

When you do not specify any drawing option when you draw a 2D histogram, the default one is used and is “scater plot”. This option draws, randomly in each histogram cell, a number of markers propotionnal to the cell content. In your case the cells are all empty except a few which contain 1. So in these not empty cells some randomly positionned markers are drawn. As the contain is small, only one marker is drawn at some random position in the cell. When you increase the number of bins the cells size becomes smaller and therefore the marker position appears better defined.
I think you are not using the right class to display your data. Seems to me a TGraph would be more appropriate