Hi to all,
I have a problem with this code.
[code]#include
void graficoDoppio()
{
ifstream file1(“file1.txt”);
double x1, y1;
TGraph *plot1 = new TGraph();
int ipoint1(0);
while (!file1.eof()) {
file1 >> x1;
if (file1.eof())
break;
file1 >> y1;
plot1->SetPoint(ipoint1,x1,y1);
ipoint1++;
}
file1.close();
plot1->SetLineColor(4);
plot1->SetMarkerStyle(20);
plot1->SetMarkerSize(1);
plot1->GetXaxis()->SetTitle(“Time”);
plot1->GetYaxis()->SetTitle(“Volts”);
plot1->Draw(“Al”);
ifstream file2(“file2.txt”);
double x2, y2;
TGraph *plot2 = new TGraph();
int ipoint2(0);
while (!file2.eof()) {
file2 >> x2;
if (file2.eof())
break;
file2 >> y2;
plot2->SetPoint(ipoint2,x2,y2);
ipoint2++;
}
file2.close();
plot2->SetLineColor(2);
plot2->SetMarkerStyle(20);
plot2->SetMarkerSize(1);
plot2->GetXaxis()->SetTitle(“Time”);
plot2->GetYaxis()->SetTitle(“Volts”);
plot2->Draw(“l”);
}[/code]
The two files have different scales. How I can plot the “file1.txt” on the Yaxis on the left, and the “file2.txt” on the Yaxis on the right?
The Xaxis is the same for both.