# Antialising TGraph

**URL:** <https://root-forum.cern.ch/t/antialising-tgraph/35509>\
**Category:** Newbie\
**Created:** [August 5, 2019, 2:18pm UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509 "2019-08-05T14:18:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marty1885](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/marty1885/32/19232_2.png) [@marty1885](https://root-forum.cern.ch/u/marty1885)\
**Post date:** [August 5, 2019, 2:18pm UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/1 "2019-08-05T14:18:03Z")

</div>

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

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/5/2/52d72adb1e22e8d9e3a4fe5a3b8d6d4abe0d3796.png)

And by matplotlib

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/6/2/62f934ca26b042075a1c5bed3e04517018541367.png)

(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?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [August 5, 2019, 2:54pm UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/2 "2019-08-05T14:54:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marty1885](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/marty1885/32/19232_2.png) [@marty1885](https://root-forum.cern.ch/u/marty1885)\
**Post date:** [August 6, 2019, 5:13am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/3 "2019-08-06T05:13:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [August 6, 2019, 6:37am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/4 "2019-08-06T06:37:16Z")

</div>

Not as far as I know…

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [August 20, 2019, 1:23pm UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/5 "2019-08-20T13:23:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marty1885](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/marty1885/32/19232_2.png) [@marty1885](https://root-forum.cern.ch/u/marty1885)\
**Post date:** [August 25, 2019, 4:07am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/6 "2019-08-25T04:07:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [August 26, 2019, 9:11am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/7 "2019-08-26T09:11:17Z")

</div>

> [@marty1885](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [August 26, 2019, 10:01am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/8 "2019-08-26T10:01:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [August 26, 2019, 10:02am UTC](https://root-forum.cern.ch/t/antialising-tgraph/35509/9 "2019-08-26T10:02:24Z")

</div>

Please find an example here:

> **[Jupyter Notebook Viewer](https://nbviewer.jupyter.org/github/dpiparo/swanExamples/blob/master/notebooks/Simple_ROOTbook_cpp.ipynb)**
>
> Check out this Jupyter notebook!
