1

I am trying to draw a figure similar to this graph I drew in desmos

enter image description here

So I wrote up this code. But I am not sure how to match the origins of the polar and cartesian curve as well as scale the polar graph so that it matches the cartesian coordinates.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{luainputenc}

\makeatletter
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}

\makeatother

\usepackage{babel}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis x line=center,
axis y line=center,
axis line style={draw=none},       
tick style={draw=none},
ytick=\empty,
xtick=\empty,
axis equal,
clip=false
]

\addplot [
    black,
    domain={-1}:{1},
    samples=200,smooth,-latex
]
        {(sqrt(1-x^2))};
\addplot [
    black,
    domain={-1}:{1},
    samples=200,smooth,latex-
]
        {(-sqrt(1-x^2))};
\addplot [
    black,
    domain={1}:{-5},
    samples=200,smooth,latex-
]
        {(2*sqrt(1-((-x-2)^2)/(9)))};
\addplot [
    black,
    domain={1}:{-5},
    samples=200,smooth,-latex
]
        {(-2*sqrt(1-((-x-2)^2)/(9)))};
\addplot [
    black,
    domain={1}:{-3},
    samples=200,smooth,-latex
]
        {2*sqrt(-x+1)};
\addplot [
    black,
    domain={1}:{-3},
    samples=200,smooth,-latex
]
        {-2*sqrt(-x+1)};
\addplot [
    black,
    domain={1}:{-0.236},
    samples=200,smooth,-latex
]
        {2*sqrt((-x+2)^2-1)};
\addplot [
    black,
    domain={1}:{-0.236},
    samples=200,smooth,-latex
]
        {-2*sqrt((-x+2)^2-1)};
\draw[fill=black!15!white] (axis cs:0,0) circle (20);
\node [left] at (axis cs:-1,0) {$v=v_O$};
\node [left] at (axis cs:-5,0) {$\sqrt{2}\cdot v_O>v>v_O$};
\node [above left] at (axis cs:-3,4) {$v=\sqrt{2}\cdot v_O$};
\node [above] at (axis cs:-0.236,4) {$v>\sqrt{2}\cdot v_O$};
\end{axis}
\begin{scope}
\begin{polaraxis}[   
axis line style={draw=none}, 
tick style={draw=none},
ytick=\empty,
xtick=\empty,
axis equal,
clip=false,
data cs=polarrad
]
\addplot[data cs=polarrad,no markers,domain=0:10,smooth,samples=200] {-0.1*x+1}; 
\end{polaraxis}
\end{scope}
\end{tikzpicture}
\par\end{center}
\end{document}

It yields the following image: enter image description here

So to reiterate my question, how would I make the polar graph have the same origin and scale as the cartesian curve like that in desmos.

1 Answer 1

5

One option is to just not use an extra polar coordinate system, but just use a parametric plot.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis x line=center,
axis y line=center,
axis line style={draw=none},       
tick style={draw=none},
ytick=\empty,
xtick=\empty,
axis equal,
clip=false
]

\addplot [
    black,
    domain={-1}:{1},
    samples=200,smooth,-latex
]
        {(sqrt(1-x^2))};
\addplot [
    black,
    domain={-1}:{1},
    samples=200,smooth,latex-
]
        {(-sqrt(1-x^2))};
\addplot [
    black,
    domain={1}:{-5},
    samples=200,smooth,latex-
]
        {(2*sqrt(1-((-x-2)^2)/(9)))};
\addplot [
    black,
    domain={1}:{-5},
    samples=200,smooth,-latex
]
        {(-2*sqrt(1-((-x-2)^2)/(9)))};
\addplot [
    black,
    domain={1}:{-3},
    samples=200,smooth,-latex
]
        {2*sqrt(-x+1)};
\addplot [
    black,
    domain={1}:{-3},
    samples=200,smooth,-latex
]
        {-2*sqrt(-x+1)};
\addplot [
    black,
    domain={1}:{-0.236},
    samples=200,smooth,-latex
]
        {2*sqrt((-x+2)^2-1)};
\addplot [
    black,
    domain={1}:{-0.236},
    samples=200,smooth,-latex
]
        {-2*sqrt((-x+2)^2-1)};
\addplot[
    no markers,
    domain=0:10,
    smooth,samples=200
]
        ({(-0.1*x+1)*cos(deg(x))},{(-0.1*x+1)*sin(deg(x))});

\draw[fill=black!15!white] (axis cs:0,0) circle (20);
\node [left] at (axis cs:-1,0) {$v=v_O$};
\node [left] at (axis cs:-5,0) {$\sqrt{2}\cdot v_O>v>v_O$};
\node [above left] at (axis cs:-3,4) {$v=\sqrt{2}\cdot v_O$};
\node [above] at (axis cs:-0.236,4) {$v>\sqrt{2}\cdot v_O$};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

Compacted code:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    axis lines=none,
    tick style={draw=none},
    axis equal,
    samples=200,
    smooth,
    every axis plot/.style={black,-latex}
    ]

    \addplot[domain=-1: 1] {(sqrt(1-x^2))};
    \addplot[domain=-1: 1] {(-sqrt(1-x^2))};
    \addplot[domain= 1:-5] {(2*sqrt(1-((-x-2)^2)/(9)))};
    \addplot[domain= 1:-5] {(-2*sqrt(1-((-x-2)^2)/(9)))};
    \addplot[domain= 1:-3] {2*sqrt(-x+1)};
    \addplot[domain= 1:-3] {-2*sqrt(-x+1)};
    \addplot[domain= 1:-0.236] {2*sqrt((-x+2)^2-1)};
    \addplot[domain= 1:-0.236] {-2*sqrt((-x+2)^2-1)};
    \addplot[domain= 0:10] ({(-0.1*x+1)*cos(deg(x))},{(-0.1*x+1)*sin(deg(x))});

    \draw[fill=black!15!white] (axis cs:0,0) circle (20);
    \node [left] at (axis cs:-1,0) {$v=v_O$};
    \node [left] at (axis cs:-5,0) {$\sqrt{2}\cdot v_O>v>v_O$};
    \node [above left] at (axis cs:-3,4) {$v=\sqrt{2}\cdot v_O$};
    \node [above] at (axis cs:-0.236,4) {$v>\sqrt{2}\cdot v_O$};

  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1
  • Of course, I seem to always forget about parametric plots. Thank you
    – sab hoque
    Sep 25, 2018 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .