some time ago, I needed to produce 4D Scatter Plots from TH3’s. I dug the forum and found some [url=https://root-forum.cern.ch/t/th3-and-th4/1073/1 thread[/url], where René Brun gave a hint on how to do it via TTree::Draw.
I wrote a patch to TH3, adding a method that does just this, similar to, e.g., TH3::SetShowProjection.
I feel it would make sense to add this functionality to the ROOT release.
The attached patch is against an older version of ROOT 5, as I wrote it some time ago. But is easily adapted to newer versions, if there’s interest. The question is: Is there interest?
We could add this functionality as an option to TH3::Draw. But your patch is not correct, we don’t want to do this by passing via a TTree, we don’t want to add the dependency to the Tree library in the Histo library.
It should be implemented in a single place in the THistPainter, and the TTree::Draw and TH1::Draw use the same code.