Antialising TGraph

Hi,
I have been running into problems when plotting graphs with very densely packed values. Where the plot generated by ROOT looks bad due to TGraph is not anti aliased.

For example

The is the plot generated by ROOT

And by matplotlib

(Please ignore the x-axis, they are on a different scale)
Where matplotlib’s plot is a lot easier on the eye.

How can I make ROOT’s plot also anti aliased?

You could try to enable GL with: gStyle->SetCanvasPreferGL(kTRUE);

@bellenot Thanks! Is there a way to also make antialiased TGraph on ROOT notebook?

Not as far as I know…

ROOT notebook can use JSRoot Graphics I think ?
That might be a solution to get antialiasing ? (SVG is antialiased)

sorry for the late reply.
I totally forget to mention about jsroot. How can I enable JSRoot under a ROOT/C++ kernel? The ROOT.enableJSVis() seems to be a python only function.

I hope @etejedor should know the answer.

Hi,
It is enough to run %jsroot on in a cell to activate the JS ROOT graphics, both in Python and in C++.
Cheers,
Enric

Please find an example here:

1 Like