plotOn frame on subrange

Dear experts,

When I plot the pdf on the frame in a subrange, I get a very wired result:

    frame = fitvar.frame()
    frame.SetYTitle(f"Events / ({fitvar.getBinWidth(0)}" + " MeV/#it{c}^{2})")
    data.plotOn(frame,  rt.RooFit.Name("data"), rt.RooFit.MarkerSize(1), rt.RooFit.MarkerStyle(8))
    model.plotOn(frame,rt.RooFit.Name("model"), rt.RooFit.FillColor(2), rt.RooFit.DrawOption("F"), rt.RooFit.NormRange("Full"), rt.RooFit.Range("etacK_signal"), rt.RooFit.VLines())

Here the etacK_signal is the subrange of the fitvar. And then I get the plot:

How should I fix it?

Do not fill the curve as a solid polygon, draw only the line.

1 Like

Hi @couet. I can draw the lines in the subrange as expected and nothing goes wrong. But when filling the color to the PDF in the subrange, it get problematic. But what I want is to fill the color in the subrange to show the mass range we choose in the data selections. Can not it realize?

The fit is considered a line. To make it a polygon, you will need to add two points on the X-axis to correctly fill the polygon. I am not sure how to do that in RooPlot.

1 Like

Try to add point but failed. Has to draw lines. Anyway, thanks!

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