The following code should plot a straight line (which it does):
void plotTest(){
TCanvas *c1 = new TCanvas("c1","c1",200,10,700,500);
double x[11] = {0,1,2,3,4,5,6,7,8,9,10};
double y[11] = {0,1,2,3,4,5,6,7,8,9,10};
TGraph* gr1 = new TGraph(11,x,y);
gr1->GetXaxis()->SetRangeUser(0,10);
gr1->GetYaxis()->SetRangeUser(0,10);
gr1->SetLineWidth(4);
gr1->SetLineColor(kRed);
gr1->Draw("AL");
gPad->RedrawAxis();
c1->RedrawAxis();
gPad->Print("TEST.pdf)");
}
However the output of this is attached.TEST.pdf (13.2 KB)
Looking at where the line meets the axes, the line colours outside of the plot
. I thought redrawing the axis would fix this, but it does not. How do I fix this?Thanks,
Jack