TGraphErrors graph(10); for (int i = 0; i < 10; i++) { graph.SetPoint(i, i, i); graph.SetPointError(i, 0.1*i, 0.2*i); graph.SetMarkerColor(kBlue); }
TGraphErrors graph(5); double x[5] = {1, 2, 3, 4, 5}; double y[5] = {1, 4, 9, 16, 25}; double ex[5] = {0.1, 0.1, 0.2, 0.2, 0.3}; double ey[5] = {0.5, 0.5, 1.0, 2.0, 3.0}; for (int i = 0; i < 5; i++) { graph.SetPoint(i, x[i], y[i]); graph.SetPointError(i, ex[i], ey[i]); graph.SetMarkerColor(kRed); }This code creates a TGraphErrors object with 5 points and sets the x and y values for each point. It also sets the error bars for each point. Finally, it sets the marker color for each point to red. Overall, the SetMarkerColor function in TGraphErrors allows you to customize the appearance of your graph.