Smooth curve not drawn correctly

A problem I have come across several times in many places is that sometimes ROOT does not correctly draw some curves accurately - often they are squared off in places.

I often find that this happens in the most annoying places: at the top of a gaussian or Landau for example.

Is there a way of forcing it to draw things properly or is this a known bug that people just live with?

(Attached is an example of it doing it to a rather complicated exponential fit to some data as this is the only example of it doing it that I could find to hand. It was saved directly to pdf so that the conversion to vector graphics elsewhere couldn’t be blamed (and yes, it does do the same thing when saving to png, and it also looks the same when viewing in a TBrowser).)
aaa.pdf (42.8 KB)

You can specify the precision with which you want to draw your function (see TF1 documentation).
By default, the function is computed at 100 points. In case of rapidly varying functions, you should increase this number by calling TF1::SetNpx. see example below.

Rene

void tf1() { TF1 *f1 = new TF1("f1","(([0] / (TMath::Exp (-(x-[3])/[2]) + TMath::Exp ((x-[3])/[1])))) + [4]",-50,150); f1->SetParameters(-8.90694,295.748,0.74935,0.95254,0.22004); f1->SetNpx(1000); f1->Draw(); }

That’s wonderful, that was exactly what I was looking for. Many thanks!