I want to plot multiple data sets into a TGraphErrors with a fixed x axis range of [0, 360]
TCanvas canvas;
vector<TGraphErrors*> graphs;
for (int i=0; i<inputRunNumbers.size(); i++) {
stringstream filenameIntegrityData;
filenameIntegrityData << inputRunNumbers.at(i) << "/TimeOfFlightScanData.dat";
matrix_double inputIntegrityData;
vector<double> inputSubRunNumbers, inputAzimuthalAngles, inputFlightTimes, inputFlightTimesErr;
read_ascii_file(filenameIntegrityData, inputIntegrityData);
inputSubRunNumbers = inputIntegrityData.at(0);
inputAzimuthalAngles = inputIntegrityData.at(1);
inputFlightTimes = inputIntegrityData.at(2);
inputFlightTimesErr = inputIntegrityData.at(3);
graphs.push_back(new TGraphErrors());
for (int j=0; j<inputSubRunNumbers.size(); j++) {
double tof = fmod(inputFlightTimes[j], repetitionTime);
if (tof < 0) tof += repetitionTime;
graphs.back()->SetPoint(inputSubRunNumbers[j], inputAzimuthalAngles[j], tof);
graphs.back()->SetPointError(inputSubRunNumbers[j], .0, inputFlightTimesErr[j]);
}
graphs.back()->SetMarkerStyle(7);
graphs.back()->SetMarkerColor(2+i);
if(i==0) {
graphs.back()->Draw("AP");
graphs.back()->GetXaxis()->SetRangeUser(0, 360.0);
graphs.back()->GetYaxis()->SetRangeUser(0, repetitionTime);
graphs.back()->Draw("AP");
canvas.Update();
}
else {
graphs.back()->Draw("P");
canvas.Update();
}
}
(inside a for-loop)
However, since the first data set goes only from 0 to ~120, the line
graphs.back()->GetXaxis()->SetRangeUser(0, 360.0);
is ignored. Could someone give me a hint? Why the heck is it not possible in ROOT to force an x axis range wider than the data?
Best thanks, Nicholas