0

I am trying to draw a picture of a line but using a polar coordinate system:

\begin{center}
\begin{tikzpicture}
\begin{polaraxis}[
xticklabels={,0,$\frac\pi6$,$\frac\pi3$,$\frac\pi2$,$\frac{2\pi}3$,$\frac{5\pi}6$,
$\pi$,$\frac{7\pi}6$,$\frac{4\pi}3$,$\frac{3\pi}2$,$\frac{5\pi}3$,$\frac{11\pi}6$}
]
\draw (\rtheta{0}{0}) -- (\rtheta{1}{30}) -- (\rtheta{1}{120});
\end{polaraxis}
\end{tikzpicture}
\end{center}

I can get most curves except ones such as plotting theta = 1 (a line).

I tried looking and found:

drawing lines using polar axis coordinate system in pgfplots

But I couldn't get this to work. This is what I keep getting:

enter image description here

1
  • 2
    \addplot[no marks] coordinates {(1,0) (1,1)};? – user229669 Dec 2 '20 at 4:38
1

According to TikZling hint:

You mean twolines like this?

\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar}


\begin{document}

\begin{center}
\begin{tikzpicture}
\begin{polaraxis}[
xticklabels={,0,$\frac\pi6$,$\frac\pi3$,$\frac\pi2$,$\frac{2\pi}3$,$\frac{5\pi}6$,
$\pi$,$\frac{7\pi}6$,$\frac{4\pi}3$,$\frac{3\pi}2$,$\frac{5\pi}3$,$\frac{11\pi}6$}
]
\addplot[no marks] coordinates {(0,0) (30,0.8) (120,1)};
\end{polaraxis}
\end{tikzpicture}
\end{center}

\end{document}

enter image description here

1
  • Yep! Simple enough... No idea why that didn't occur to me. Thanks. – Ecoi Dec 2 '20 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.