How to set nbins for RooPlot object after obtaining it from a fitting result?

RooPlot* mJpsi3686frame = mJpsi3686.frame();
realdata.plotOn(mJpsi3686frame);
    summJpsi3686.plotOn(mJpsi3686frame,LineColor(4));
 summJpsi3686.plotOn(mJpsi3686frame,Components(key1),LineStyle(4),LineColor(2), LineWidth(3));
    summJpsi3686.plotOn(mJpsi3686frame,Components(key2),LineStyle(2),LineColor(7), LineWidth(3));
   
    mJpsi3686frame->SetAxisRange (3.55,3.75,"X");
    mJpsi3686frame->SetNdivisions (50, "X");//????
    mJpsi3686frame -> Draw();

It seems like “mJpsi3686frame->SetNdivisions (50, “X”);” doesn’t work and the number of bins is still 100. So how can I set the number of bins into another one?

Thank you very much,
Dyson

The number of divisions on the X axis is not related to the number of bins. Try something like:

    summJpsi3686.plotOn(mJpsi3686frame,Components(key2),LineStyle(2),LineColor(7), LineWidth(3), Binning(50, 3.55, 3.75));

Thanks for your reply!
The problem has been solved.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.