Dear experts,
I try to remove the red line on the fitting plane as shown on the plot below, but I have no idea about it,
could you please help me, thanks very much.
The code is also attached.
Hi, Couet,
Thank you for helping, I try to use your way, but it does work whatever adding in any line.
Is something wrong in the attached code? rr.C (745 Bytes)
Ah yes sorry, transparency does not work on all platforms. Better do:
double fitf(Double_t *x,Double_t *par){
double fitval=(par[0]*x[0]+par[1]*x[1]+par[2]);
return fitval;
}
void rr()
{
const int bin = 40;
auto c = new TCanvas("c","c",800,600);
auto h = new TH3F("h","h",bin,0,50,bin,0,50,bin,0,50);
TRandom ran;
double nn = 22;
for (int i=0; i<5000; i++) {
h->Fill(ran.Poisson(nn),ran.Poisson(nn),ran.Poisson(10)+10);
}
auto f1 = new TF2("f1",fitf,0,50,0,50,3);
f1->SetLineWidth(0.);
f1->SetParameters(1,1,10);
f1->SetMinimum(0);
f1->SetMaximum(50);
h->Fit(f1);
f1->Draw("surf2");
h->Draw("same BOX2 Z");
}