# How do I choose only one branch of ArcTan? [duplicate]

I have a problem concerning ArcTan drawing a graph using ListPlot. I import a table of data:

a = Import["D:\2_b=10a.txt", "Table"];

Then I write:

ListPlot[Table[{i*0.005 Pi, -ArcTan[(a[[i]][[1]] -
a[[i - 1]][[1]]), (a[[i]][[2]] - a[[i - 1]][[2]])]}, {i, 2, 401, 1}]], PlotRange -> {{0, Pi}, {-4, 4}}]

The returned graph looks like

I know from the nature of my calculations that the function must be continuous on the interval $[0,Pi]$, but at $3Pi/4$ the ArcTan function goes to another branch, since ArcTan[x,y] chooses a quadrant. How could I possibly try to move the bottom part of the plot up by Pi, so the function is smooth and continuous?

I tried defining a function

myArcTan[x_] := Piecewise[{{ArcTan[x] + Pi, x < 0}, {ArcTan[x], x > 0}}];

but it doesn't work. Thank you very much.

• This or this might help. – Daniel Lichtblau Aug 14 '14 at 17:42
• Please upload your data or provide a self-contained example. – Mr.Wizard Aug 14 '14 at 20:37