Graph with strings as x axis

void plot() {
   auto c = new TCanvas("c", "c", 1000, 800);
   Double_t x[3] = {1,2,3};  
   Double_t y[3] = {1,5,2}; 
   std::string colour[3] = { "Blue", "Red", "Green"}; 

   auto gr = new TGraph(3,x,y);
   gr->SetMarkerStyle(20);
   GraphDoubleString(gr,colour);
   c->Print("c.pdf");
}

Perfect. Thank you. Is there a solution to the macro within a macro question? It has been pertinent in other parts of this project too.

I do not understand what you mean …

Wow … difficult to follow ! … yes you can execute a macro using Processline. but if that particular ca I do not think it will help.

I wanted to call your macro earlier because it clearly worked when calling the macro, but not when I pasted your macro into mine. The problem was that I couldn’t reference things like “gr” and “color” because those were declared in c and not in root. This is why I was wondering if I could execute a macro in a programmatic way.