Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
df021_createTGraph.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_dataframe
3 /// \notebook -draw
4 /// This tutorial shows how to fill a TGraph using the Dataframe.
5 ///
6 /// \macro_code
7 /// \macro_image
8 ///
9 /// \date July 2018
10 /// \author Enrico Guiraud, Danilo Piparo, Massimo Tumolo
11 
12 
13 
14 void df021_createTGraph()
15 {
16  ROOT::EnableImplicitMT(2);
17 
18  ROOT::RDataFrame d(160);
19 
20  // Create a trivial parabola
21  auto dd = d.Alias("x", "rdfentry_").Define("y", "x*x");
22 
23  auto graph = dd.Graph("x", "y");
24 
25  // 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.
26  graph->Sort();
27  auto c = new TCanvas();
28  graph->DrawClone("APL");
29 }