# How to plot a curve in a polar form r = f(Θ)?

Can we use LaTeX to make the graph of $\rho = \sec(\theta)$?

• Have a look at this question: tex.stackexchange.com/a/65447/15925 . – Andrew Swann Nov 24 '13 at 11:36
• You have a list of your questions here. Some of them have already had answers. If the answers satisfied you, please kindly accept them by clicking the check mark button below the score labels. Optionally you should vote them up by clicking the upward arrow button. You can also vote them down but only for the extreme cases! – kiss my armpit Nov 24 '13 at 15:45

You can use pgfplots to achieve this:

\documentclass[tikz]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\def\FREQUENCY{3}
\end{polaraxis}
\end{tikzpicture}
\end{document}


The source code is self-explanatory for anyone who have minimal experience in LaTeX.

Note: pgfplots by default uses degrees, for using radians you then need to convert it to degree via deg() function. And the \rho=\sec\theta (that's a pretty ugly function to plot it on the polar axis):

\documentclass[tikz]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\end{polaraxis}
\end{tikzpicture}
\end{document} • It is not \rho=\sec \theta. – kiss my armpit Nov 24 '13 at 11:50
• @DonutE.Knot: I've added the \rho=\sec\theta. It's a straight line indeed. – m0nhawk Nov 24 '13 at 11:56

The polar with the corresponding cartesian plot:

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}

\begin{document}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,labelFontSize=\scriptstyle](3,0)
\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt,plotpoints=500,
yMaxValue=3.5]{Pi neg}{Pi}{1/(cos(x))}
\psplot[algebraic,linecolor=blue,plotpoints=5000,yMaxValue=3.5]{Pi neg}{Pi}{1/(cos(x))}
\end{pspicture}

\end{document} If you want to see the calculated points use showpoints:

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}

\begin{document}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,labelFontSize=\scriptstyle](3,0)
\psplot[polarplot,algebraic,linecolor=red,linewidth=1.5pt,plotpoints=25,showpoints,
yMaxValue=3.5]{Pi neg}{Pi}{1/(cos(x))}
\end{pspicture}

\end{document} A recommended solution with PSTricks. \rho=\sec\theta represents the line x=1. So the correct curve should be like below.

\documentclass[border=12pt,pstricks]{standalone}

\usepackage{pst-plot}

\psset{runit=1.2cm,unit=\psrunit}
\pstVerb{/const 2 def}

\begin{document}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,labelFontSize=\scriptstyle](3,3)
\psplot[polarplot,algebraic=true,linecolor=red,linewidth=2pt,plotpoints=1000,yMaxValue=3.5,yMinValue=-3.5]{0}{TwoPi}{const/(cos(x))}
\end{pspicture}
\end{document} My package xpicture plots polar curves (or more general, parametric curves).

For example

% Cardioide: r = 1+cos t
\SUMfunction{\ONEfunction}{\COSfunction}{\ffunction} % Define f(t)=1 + cos t
\POLARfunction{\ffunction}{\cardioide}  % Declare \cardioide as r=f(\phi)
% \degreespolarlabels              % Uncomment to label angles in degrees

\begin{center}
\def\runitdivisions{2}              % 2 divisions of unity in the r-axis
\setlength{\unitlength}{1.5cm}
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\polargrid{2}{16}  % Draw a polar grid for 0<r<2 and 16 divisions of circle
\pictcolor{blue}\linethickness{1pt}
\PlotParametricFunction{\cardioide}{0}{\numberTWOPI}
% Draw \cardioide for 0<\phi<2\pi
\end{Picture}

$\rho=1+\cos\phi$
\end{center}
{"ft_lang_label":"__label__en","ft_lang_prob":0.5225837,"math_prob":0.98415965,"size":3952,"snap":"2019-51-2020-05","text_gpt3_token_len":1348,"char_repetition_ratio":0.11879433,"word_repetition_ratio":0.06043956,"special_character_ratio":0.28947368,"punctuation_ratio":0.16733068,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9986864,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,2,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-11T20:55:28Z\",\"WARC-Record-ID\":\"<urn:uuid:ab078418-f374-45ac-9e45-7f1a1ff842a4>\",\"Content-Length\":\"156945\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:37da35b7-d1e3-42c9-89a7-5e178657879e>\",\"WARC-Concurrent-To\":\"<urn:uuid:db69867a-5808-4b5f-b39c-97a513244445>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/146671/how-to-plot-a-curve-in-a-polar-form-r-f%CE%98\",\"WARC-Payload-Digest\":\"sha1:ZZXNLRKYXNNLK4D2XDQQZJD34GANRLL7\",\"WARC-Block-Digest\":\"sha1:SI6BMGFBG4EMKPIZ47V7KRPENTN7VNRK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540532624.3_warc_CC-MAIN-20191211184309-20191211212309-00537.warc.gz\"}"}