I paste an instance from the primer and form a .C file, then I run it on terminal. But nothing happened?!
There is nothing in the canvas. I swear the code is right.
#include “TCanvas.h”
#include “TROOT.h”
#include “TGraphErrors.h”
void macro1(){
const int n_points=10;
double x_vals[n_points]={1,2,3,4,5,6,7,8,9,10};
double y_vals[n_points]={6,12,14,20,22,24,35,45,44,53};
double y_errs[n_points]={5,5,4.7,4.5,4.2,5.1,2.9,4.1,4.8,5.43};
TGraphErrors graph(n_points,x_vals,y_vals,nullptr,y_errs);
graph.SetTitle(“Measurement XYZ;lenght [cm];Arb.Units”);
graph.SetMarkerStyle(kOpenCircle);
graph.SetMarkerColor(kBlue);
graph.SetLineColor(kBlue);
auto mycanvas = new TCanvas();
graph.DrawClone(“APE”);
mycanvas->Print(“graph_with_law.pdf”);
}
int main(){
macro1();
}