Hi, I am trying to read in a text file that has two columns and plot it on a TGraph. I wrote out some code that casts it into a vector and then plots it however I am getting a blank document. Here is my code:
void plotNewIso(){
Double_t x1[16], y1[16];
std::ifstream in("New-Isotopes_C.txt");
std::vector<std::pair<int, int>> vec;
int P, N;
while(in >> P && in >> N){
vec.push_back((std::make_pair(P, N)));
}
int n = vec.size();
for(int i = 0; i<n; i++){
x1[i] = vec[i].first;
y1[i] = vec[i].second;
}
TGraph* gr = new TGraph(n,x1,y1);
TCanvas *c4 = new TCanvas("c4", "New Carbon",0,8,0,8);
gr->Draw("AC");
c4->Print("plots/New_Isotopes.pdf[");
c4->Print("plots/New_Isotopes.pdf]");
}
I am still getting a totally blank page. Does it have to do with my TCanvas? I am using Cygwin so I need to make it into a pdf like I did in order to see it. Is there an import I am missing for that?