void ternary_plot() { TCanvas *cnv = new TCanvas("cnv", "Ternary plot", 600, 600); cnv->Range(-0.2, -0.2, 1.2, 1.2); const UInt_t n = 3; // C A B const double samples[][3] = {{/*Organic matter*/0.8, /*Clay*/0.1, /*Sand*/0.1}, {/*Organic matter*/0.5, /*Clay*/0.4, /*Sand*/0.1}, {/*Organic matter*/0.1, /*Clay*/0.4, /*Sand*/0.5}}; const Double_t yC = TMath::Sqrt(3.) / 2; Double_t xs[n] = {}; Double_t ys[n] = {}; for (UInt_t i = 0; i < n; ++i) { xs[i] = samples[i][2] + samples[i][0] / 2; ys[i] = yC * samples[i][0]; } TGraph *ternaryPlot = new TGraph(n, xs, ys); ternaryPlot->Draw("*"); TGaxis *a1 = new TGaxis(0., 0., 0.5, yC, 0., 100.); a1->Draw(); TGaxis *a2 = new TGaxis(0.5, yC, 1., 0., 0., 100.); a2->Draw(); TGaxis *a3 = new TGaxis(1., 0., 0., 0., 0., 100.); a3->Draw(); }