Proposal/Patch: 4D Scatter Plot Method for TH3


some time ago, I needed to produce 4D Scatter Plots from TH3’s. I dug the forum and found some [url= 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?

Best regards,
root4dscatter.patch.txt (3.71 KB)


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.


look at:

void THistPainter::PaintH3(Option_t *option)

it does:

   } else {
      cmd = Form("TPolyMarker3D::PaintH3((TH1 *)0x%lx,\"%s\");",(Long_t)fH,option);

This is where to add the 4th dimension. Via some new option in TPolyMarker3D::PaintH3


Sorry, but what do you mean by “not correct”? It works just fine / produces the intended plot.

Okay, this I understand.

As I said, I found that old post and modelled my code after the projection methods…

Thanks. I will have a look.