@couet Here is the working reproducible in C++, w/o RDataFrame
void foxwise() {
auto h = new TH2F("h", "title;x;y", 100, 0.001, 5, 100, 0., 5);
for(int i=0; i < 100000; i++){
double x = gRandom->Uniform(0., 5.);
double y = gRandom->Uniform(0., 5.);
h->Fill(x, y);
}
auto c = new TCanvas();
h->Draw("colz");
h->SetStats(0);
c->SetLogx();
}
// right-click on the histogram and SetShowProjectionY afterwards
@eguiraud , do you have an idea, why RDataFrame version above, shows a blank canvas in the end?
Or it is just for me?
It’s a common lifetime issue: the histogram goes out of scope at the end of the function. See e.g. I draw a canvas with no picture - #3 by eguiraud . Possible solutions are calling DrawClone instead of Draw or returning the histogram from the function to keep it alive in the outer scope.
I can run your example now.
Seems to me that ProjectionY takes into account the fact there is a log scale along X. The mouse moves are correctly reflected in the new window: the 1D histogram changes at the border of log bins. It is hard to tell if the histogram is correct or not thought.
Yes, ProjectionY works properly. It is only the highlighting is wrong.
If you switch to the linear scale, highlighted bin will indicate the bin where the mouse is. Just for easier visual tracking of the plotted bin in the second window.
With the logarithmic axis, the bin where the mouse is is NOT highlighted. Highlighted are some random bins on the right.
So it’s really a visual convenience bug, not a calculation one
Actually for me there is not bin highlighting at all, neither in linear or log scale. I move the cursor over the COL plot and I see the 1D histogram changing.