TransWikia.com

Drawing lines in polar coordinates (polaraxis)

TeX - LaTeX Asked on April 22, 2021

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

begin{center}
begin{tikzpicture}
begin{polaraxis}[
xticklabels={,0,$fracpi6$,$fracpi3$,$fracpi2$,$frac{2pi}3$,$frac{5pi}6$,
$pi$,$frac{7pi}6$,$frac{4pi}3$,$frac{3pi}2$,$frac{5pi}3$,$frac{11pi}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

One Answer

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,$fracpi6$,$fracpi3$,$fracpi2$,$frac{2pi}3$,$frac{5pi}6$,
$pi$,$frac{7pi}6$,$frac{4pi}3$,$frac{3pi}2$,$frac{5pi}3$,$frac{11pi}6$}
]
addplot[no marks] coordinates {(0,0) (30,0.8) (120,1)};
end{polaraxis}
end{tikzpicture}
end{center}

end{document}

enter image description here

Correct answer by Roland on April 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP