Df 0 2 1_Create T Graph

Fill a TGraph using RDataFrame.

Author: Enrico Guiraud, Danilo Piparo (CERN), Massimo Tumolo (Politecnico di Torino)
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Thursday, June 24, 2021 at 07:16 AM.

In [ ]:
import ROOT

ROOT.ROOT.EnableImplicitMT(2)
d = ROOT.RDataFrame(160)

Create a trivial parabola

In [ ]:
dd = d.Alias("x", "rdfentry_").Define("y", "x*x")

graph = dd.Graph("x", "y")

This tutorial is ran with multithreading enabled. The order in which points are inserted is not known, so to have a meaningful representation points are sorted.

In [ ]:
c = ROOT.TCanvas()
graph.Sort()
graph.Draw("APL")
c.SaveAs("df021_createTGraph.png")

print("Saved figure to df021_createTGraph.png")

Draw all canvases

In [ ]:
from ROOT import gROOT 
gROOT.GetListOfCanvases().Draw()