Math & Sciencedraw a graph

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Post by magi6162 »

I am a newbie to latex and also to this forum.
I have to draw in vector format as in the attached figure. I kindly ask for suggestions.
Thanks
Attachments
Fig009.jpg
Fig009.jpg (90.64 KiB) Viewed 6436 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

draw a graph

Post by Stefan Kottwitz »

Welcome to the forum!

What is the math formula for that graph you want to draw?

Stefan
LaTeX.org admin
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Post by magi6162 »

I don't know it, so I was wondering if anyone on the forum knows it. (parametric also should work well with asymptote)
Thanks for the welcome and for the help.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

draw a graph

Post by Stefan Kottwitz »

It looks like a copy from a book, so perhaps there is some math context for parametrization?

Stefan
LaTeX.org admin
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Post by magi6162 »

unfortunately no, it's just an example
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

draw a graph

Post by Stefan Kottwitz »

Ok, then here is a similar example:

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[
      domain  = 0:1440,
      samples = 1000,
    ]
    \addplot[thick, blue] {sin(1.1*x)^2};
    \legend{$\sin(1.1x)^2$}
    \end{polaraxis}
\end{tikzpicture}
\end{document}
plot.png
plot.png (34.38 KiB) Viewed 6378 times
Put in what you think the formula may be.

Seems the figure is from Landau and Lifshitz, Mechanics, Vol. 1, figure 9 in 14. Motion in a central field. That may explain how to (re)produce it.

It's also seen as figure 6.1 (Open path of a particle) from the paper KAM Stability of The Kepler Problem with a General Relativistic Correction Term by Majed Sofiani.

Stefan
LaTeX.org admin
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Post by magi6162 »

Thanks, invaluable help
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

draw a graph

Post by Stefan Kottwitz »

Here's a drawing repeating ellipses. This seems to come close, elliptic movements repeated.

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[
      domain  = 0:360,
      samples = 100,
    ]
    \foreach \w in {0,30,...,360} {
      \addplot[thick, blue] {(1*(1-0.8^2)/(1+0.8*cos(x+\w))};}
    \end{polaraxis}
\end{tikzpicture}
\end{document}
plot-ellipses.png
plot-ellipses.png (39.91 KiB) Viewed 6375 times
You can compare the formula to the equation 3.2 in the appendix of the article I linked above.

With an arrow decoration macro from the pgfplots author Christian Feuersänger:

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usepgfplotslibrary{colormaps}
\usetikzlibrary{decorations.markings}
\tikzset{
  set arrow inside/.code={\pgfqkeys{/tikz/arrow inside}{#1}},
  set arrow inside={end/.initial=>, opt/.initial=},
  /pgf/decoration/Mark/.style={
    mark/.expanded=at position #1 with
    {
      \noexpand\arrow[\pgfkeysvalueof{/tikz/arrow inside/opt}]{\pgfkeysvalueof{/tikz/arrow inside/end}}
    }
  },
  arrow inside/.style 2 args={
    set arrow inside={#1},
    postaction={
      decorate,decoration={
        markings,Mark/.list={#2}
      }
    }
  },
}
\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[
      domain  = 0:360,
      samples = 100,
    ]
    \foreach \w in {0,30,...,360} {
      \addplot[thick, blue] {(1*(1-0.8^2)/(1+0.8*cos(x+\w))} [arrow inside={end=stealth,opt={black, scale=1.05}}{0.5}];}
    \end{polaraxis}
\end{tikzpicture}
\end{document}
plot-with-arrows.png
plot-with-arrows.png (40.47 KiB) Viewed 6375 times
Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

draw a graph

Post by Stefan Kottwitz »

And with the option hide axis:
plot-hidden-axis.png
plot-hidden-axis.png (21.34 KiB) Viewed 6371 times

Code: Select all

\begin{polaraxis}[
      domain  = 0:360,
      samples = 100,
      hide axis,
    ]
    ...
Stefan
LaTeX.org admin
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Post by magi6162 »

I have no words for the help you have given me. Thank you so much
Post Reply