# How do you draw a straight line with PolarPlot?

I can't figure how to draw a line with PolarPlot.

A vertical line through a is $r \cos(\theta) = a$, so

PolarPlot[a/Cos[theta], {theta, -Pi, Pi}]


works.

A horizontal line through b is $r \sin(\theta)=b$, so

PolarPlot[b/Sin[theta], {theta, -6, 6}]


works. (Using {theta, -Pi, Pi} doesn't work because of dividing by $\sin(0)=0$ I guess.)

How do I draw a radial line with $\theta = \pi/3$? Should be a line with slope $\tan(\pi/3)$. Can it be done with PolarPlot? I guess not since you have to give a function of $r$.

-
Related question: "how do I draw the line $x=1$ using only Plot[]?" –  Ｊ. Ｍ. Apr 29 '13 at 3:59
You can't draw this exactly but you can define a tangent arc of arbitrarily large radius which passes through the origin at the angle you want. Try creating a circle with variable radius which you can get to cut through (0,0) and then increase the radius until it looks like you want it to. –  Jonathan Shock Apr 29 '13 at 5:11
Can't you just use Epilog for this goal? –  Sjoerd C. de Vries Apr 29 '13 at 5:45

My friend, what you ask for is madness. Assuming you're completely aware of just doing this, or similar:

Show[
PolarPlot[{4/Cos[theta], 4/Sin[theta]}, {theta, -6, 6}],
Graphics[Rotate[Line[500 {{-1, 0}, {1, 0}}], Pi/3]]]


Here's the most obvious brute-force mickey mouse approach:

PolarPlot[{4/Cos[theta], 4/Sin[theta], Evaluate[
If[Pi/3 < theta < Pi/3 + 4/(2 Pi Abs[#]), #] & /@
Range[-30, 30, .717]
]}, {theta, -6, 6}, PlotRange -> 40, PlotPoints -> 400,
PlotStyle -> {{Thickness[.01]}, {Thickness[.01]}, Thickness[.01]}]


Exchanging some accuracy for performance:

PolarPlot[{4/Cos[theta], 4/Sin[theta],
If[Pi/3 < theta < Pi/3 + .03, Range[-30, 30, .717]]
}, {theta, -6, 6}, PlotRange -> 40, PlotPoints -> 400,
PlotStyle -> {Thickness[.01], Thickness[.01], Thickness[.01]}]


I mention these to show how arbitrary your functions in Plots can be.

Here's one implementation of @Jonathan's idea:

PolarPlot[{4/Cos[theta], 4/Sin[theta], .2/(theta - Pi/3)},
{theta, -2.1 Pi, 2.1 Pi}, PlotRange -> 40]


Another, flakier version:

PolarPlot[{4/Cos[theta], 4/Sin[theta], 10000 (theta - Pi/3)},
{theta, -2.1 Pi, 2.1 Pi}, PlotRange -> 40]


-