#include "TCanvas.h" #include "TGraph.h" #include "TMath.h" #include "TMarker.h" void graph_var_points() { Int_t np = 6; TCanvas *c = new TCanvas(); TGraph *gr = new TGraph(np); TMarker *marks[np]; // make it invisible gr->SetMarkerStyle(1); gr->SetMarkerColor(0); for (Int_t i =0; i < np; i++) { Double_t x = ((Double_t)(i+1))*0.5; Double_t y = TMath::Sin(x); gr->SetPoint(i, x, y); } gr->Draw("A*"); Double_t *gx = gr->GetX(); Double_t *gy = gr->GetY(); for (Int_t i =0; i < np; i++) { marks[i]= new TMarker(gx[i],gy[i], 20); marks[i]->SetMarkerSize(gy[i]*3); marks[i]->SetMarkerColor((i+1)%7); marks[i]->Draw(); } c->Modified(); c->Update(); }