There are infinitely many ways a circle can be centered on a line and pass through a given point, except for the case when a line segment from the center to the given point is required to be orthogonal to that line. In that case the circle would be unique. Therefore I will suppose that is what you actually require. Let the line run through points Pa = [a1;a2] and Pb = [b1;b2] and let the circle have its center on that line and pass through the point Q = [x;y], along with the above orthogonality requirement.
t = dot(Pb-Pa,Pb-Q)/dot(Pb-Pa,Pb-Pa);
C = t*Pa+(1-t)*Pb;
R = norm(Q-C);
p = linspace(0,2*pi,1000);
(Of course you will also want the line to appear on the plot. I leave that to you.)
(Also I leave to you the need to do all the above for several points in an array and a like number of circles instead of a single Q, for which you will presumably need an appropriate for-loop.)