Draw a scatter plot.
Author: Olivier Couet
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Wednesday, April 17, 2024 at 11:12 AM.
auto canvas = new TCanvas();
gStyle->SetPalette(kBird, 0, 0.6); // define a transparent palette
const int n = 100;
double x[n];
double y[n];
double c[n];
double s[n];
Define four random data set
auto r = new TRandom();
for (int i=0; i<n; i++) {
x[i] = 100*r->Rndm(i);
y[i] = 200*r->Rndm(i);
c[i] = 300*r->Rndm(i);
s[i] = 400*r->Rndm(i);
}
auto scatter = new TScatter(n, x, y, c, s);
scatter->SetMarkerStyle(20);
scatter->SetTitle("Scatter plot;X;Y");
scatter->Draw("A");
Draw all canvases
gROOT->GetListOfCanvases()->Draw()