How to show the coordinates of a 3D graph

ROOT Version: 6.26/06
Compiler: macOS

Hi! i have been working on a 3D plot.
I have no issue with the plot (I’m attaching the c file and its txt file).

But I’d like to show the coordinates of the points on the graph.

I think I can do something horrible like making many little legends which have the coordinates and moving these to points, but I’m hoping there is a better way to do it.

I hope you can help me,
thanks for the time wasted for me!

magnetizzazione.C (1.2 KB)
plot3Di.txt (300 Bytes)
)

Indeed Text3D is missing forwhat you want to do.

void magnetizzazione(){
   TGraph2D *graph1 = new TGraph2D("plot3Di.txt");
   graph1->SetTitle("mappa del campo magnetico; larghezza (cm); altezza(cm); B (mT)");
   gStyle->SetPalette(1);
   graph1->SetMarkerStyle(20);
   gStyle->SetHistTopMargin(0);
   graph1->Draw("surf1");

   TGraph2D *graph = new TGraph2D("plot3Di.txt");
   graph->SetMarkerColor(kBlack);
   graph->SetMarkerStyle(20);
   graph->Draw("SAME P0");

   gPad->Update();

   TView *view = gPad->GetView();
   if (!view) return;

   int n = graph->GetN();
   double x,y,z;
   double xyz[3];
   for (int i=1; i<n; i++) {
      graph->GetPoint(i,x,y,z);
      xyz[0] = x;
      xyz[1] = y;
      xyz[2] = z;
      Double_t xpad[3];
      view->WCtoNDC(xyz, &xpad[0]);


      auto l = new TLatex(xpad[0],xpad[1]+0.02,Form("(%4.2f, %4.2f, %4.2f)",x,y,z));
      l->SetTextSize(0.02);
      l->SetTextFont(42);
      l->SetTextAlign(21);
      l->Draw();
   }
}

Oh! Thank you so much!
Have a nice day!

Rrapo