Bin Label with THnSparse

Hello,

The bin labels are not displayed when using a THnSparse projection.

int bins[1]={3} ;
double edges[4]={0,1,2,3} ;
THnSparse* hn = new THnSparseD("","",1,bins) ;
hn->SetBinEdges(0,edges) ;
hn->GetAxis(0)->SetBinLabel(1,“john”)
hn->Projection(0)->Draw()

It looks like the projected histogram axis doesn’t point to the original THnSparse axis.
In case of a copy, can the bin labels be replicated too ?

Many thanks
Best regards
Renaud

Renaud,

Currently the projected histogram does not inherits the properties of the parent. The reason is that you can project a subset of the parent axis only.
Instead of

hn->GetAxis(0)->SetBinLabel(1,"john") hn->Projection(0)->Draw() do

TH1D *hproj = hn->Projection(0)->Draw() hproj->GetXaxis()->SetBinLabel(1,"john")

Rene