Coloured scatterplot from TDataFrame

Hi garjola,
scatterplots in ROOT are provided by TGraph. TTree::Draw is a handy feature to quickly produce histograms and TGraphs from trees. TDataFrame does not provide a specific action to produce TGraphs, but you can always use Foreach:

TGraph g;
auto fillGraph = [&g](double x, double y) { g.SetPoint(g.GetN(), x, y); };
tdf.Foreach(fillGraph, {"x", "y"});

I hope this helps you doing what you want.

As a side note, in the example code that you linked each TTree::Draw call makes a separate loop over all data – if you fill multiple TGraphs in the same Foreach lambda, TDataFrame loops over data once and fills everything saving you some runtime.

Cheers,
Enrico