// c++ -o reproducer reproducer.cpp `root-config --cflags --glibs` #include "print.cpp" // there were more custom libraries here, btw using namespace std; int main () { ifstream infile; // i calculated the data and wrote them in a .txt file // to "cut" the previous part of the code vector < double > X; vector < double > Y; double x; double y; // Read File infile.open( "data.txt", ios::in ); while (1) { infile >> x >> y; if( infile.eof() ) break; X.push_back(x); Y.push_back(y); } infile.close(); // Fill TH2F double range1 = 150; double range2 = 1.5e-7; // this is read from a file, but there are no issues with this TH2F scat ( "", "", 100, -range1, +range1, 100, -range2, +range2 ); // setting a new axis range "manually" can mess up this th2f string path; path = "reproducer"; int n = 0; while ( 1 ) { scat.Fill( X[n] , Y[n] ); // this does not work: either blank or messed up (line 28 ) n++; if ( n == X.size() || n == Y.size() ) break; } Print_ScatterPlot ( path, scat, "_scat.png" ); return 0; }