3

I'm currently trying to graph the flow applied to some points of the 2,3-dimensional euclidean space, and it has been quite hard to do.

What I want is to graph something like this

enter image description here

and this

enter image description here

using expresions like this

enter image description here

with this cleaner and better looking design

enter image description here

Is it possible to do so?

PS.: "sen" means sine.


Updates:

For the first example, the suggestion Daniel N. made mostly worked.

\documentclass[dvipsnames, margin = 5mm]{standalone}
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=newest}

\def\Point{36.9}

\begin{document} \tdplotsetmaincoords{80}{130} \begin{tikzpicture}[tdplot_main_coords, scale = 1]

\begin{axis}[ axis lines=middle, height=12cm, xtick=\empty, ytick=\empty, ]

\addplot[variable=\t, domain=.063:4, samples=80] plot (\t, 1/\t);

\addplot[variable=\t, domain=.063:4, samples=80] plot (-\t, 1/\t);

\addplot[variable=\t, domain=.063:4, samples=80] plot (\t, -1/\t);

\addplot[variable=\t, domain=.063:4, samples=80] plot (-\t, -1/\t);

\addplot[variable=\t, domain=.067:3.7, samples=80] plot (\t+0.3, 1/\t+1);

\addplot[variable=\t, domain=.067:3.7, samples=80] plot (-\t-0.3, 1/\t+1);

\addplot[variable=\t, domain=.067:3.7, samples=80] plot (\t+0.3, -1/\t-1);

\addplot[variable=\t, domain=.067:3.7, samples=80] plot (-\t-0.3, -1/\t-1);

\end{axis} \end{tikzpicture}

\end{document}

This code wielded this image enter image description here

which is okay. With a few tweaks it will be perfect.

The second one, however, it's tricky. I've found an example that resembles what I am looking for, but I'm still having trouble shaping it.

\documentclass[dvipsnames, margin = 5mm]{standalone}
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=newest}

\def\Point{36.9}

\begin{document} \tdplotsetmaincoords{80}{130} \begin{tikzpicture}[tdplot_main_coords, scale = 1]

\begin{axis}[ view={-5 0}{-20}, axis lines=middle, zmax=60, height=12cm, xtick=\empty, ytick=\empty, ztick=\empty ]

\addplot3+[,ytick=\empty,yticklabel=\empty, mark=none, thick, Black, domain=2:16.7pi, samples=400, samples y=0, ] ({(1/x)sin(0.28pideg(x))},{(1/x)cos(0.28pi*deg(x)},{x+20});

\addplot3+[,ytick=\empty,yticklabel=\empty, mark=none, thick, Black, domain=2:16.7pi, samples=400, samples y=0, ] ({(1/x)sin(0.28pideg(x))},{(1/x)cos(0.28pi*deg(x)},0);

\addplot3+[,ytick=\empty,yticklabel=\empty, mark=none, thick, Black, domain=2:16.7pi, samples=400, samples y=0, ] ({-(1/x)cos(0.28pideg(x))},{-(1/x)sin(0.28pi*deg(x)},{-x-20});

\end{axis} \end{tikzpicture}

\end{document}

This code wields this image enter image description here

which is almost what I want. The problem is the curve not approaching the z-axis quickly enough.

  • 1
    Yes, it certainly is. However, it would be nice if you gave it a try yourself first. You put the tags tikz-pgf and pgfplots to your question which shows that you at least know which packages to start with. Look around on this site to come up with a first code example. I am pretty sure that something similar to the above can already be found around here. If you get stuck, please feel free to ask about the concrete problems you have. – Jasper Habicht Nov 01 '22 at 23:02
  • I did try with those packages, but the code wouldn't compile. I also tried with gnuplots and maxima. But I admit I am much more experienced with the tikz-cd and xymatrix packages, so I will read the documentation and post here what I come up with. – Fractal Admirer Nov 02 '22 at 19:02
  • Hi! I think that the first drawing should be done with TikZ only, with no fancy library. It is a coordinate system with some hyperbolas added. You should start with hyperbolas using the function plot, something like \draw[variable=\t, domain=.063:4, samples=50] plot (\t, 1/\t);. Then you vary a constant to obtain a different one... Of course, we'll not have the arrows, but I promise to help you add those afterwards (it is mainly a decoration). – Daniel N Nov 03 '22 at 17:18
  • Thank you, Daniel. I did that and it sort of worked, The only problem is when I plot the "outer" curves, the assymptotes should be the x and y axes. But it is a promissing start. I'll answer my question with your suggestion and with what I came up with for the other one. – Fractal Admirer Nov 08 '22 at 18:31
  • HI @Fractal Admirer ! I didn't know you had left a message and advanced in your drawing. (You should use the syntax @UserName next time.) It's a nice result. Concerning your last question (the trajectory not approaching the z axis quickly enough), you can always modify the scaling. For example, try to set in the first drawing domain=2:30*pi and {.7*(x+20)} for the z coordinate. Compare the upper curve and the lower curve; maybe it is what you are looking for. – Daniel N Nov 12 '22 at 11:19
  • @DanielN Thank you man. Now I only need to put the arrow markings in place: how may I do it? – Fractal Admirer Nov 16 '22 at 17:34

1 Answers1

4

enter image description here

The sense on the trajectory should be given, I think, through a decoration. But I don't know how to include a decoration in \addplot such that only the curve be touched, and not the axes. So I reformulated your solution without using pgfplots

The decoration is called sense and depends on three arguments: the position on the curve, the slanted angle (to link it to the osculating plane of the curve), and the length (of the tip) in points.

If you need to revert the sense on the trajectory, you have to change \arrow into \arrowreversed.

Remarks.

  1. I defined the coordinates such that the plane Oxy corresponds to the plane defined by the scree when the longitude is 0.
  2. There are constants in the code to disconnect the curves' scaling from the coordinate system.
  3. I tried to respect your choices concerning the upper and lower trajectories. They seem slightly strange to me. There should be some sort of continuity when crossing the horizontal plane.

The code

\documentclass[11pt, margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math, calc}
\usetikzlibrary{decorations.markings, arrows.meta}
\begin{document}

\tikzset{% view/.style 2 args={% z={({-sin(#1)}, {-cos(#1)sin(#2)})}, x={({cos(#1)}, {-sin(#1)sin(#2)})}, y={(0, {cos(#2)})}, evaluate={% \tox={sin(#1)cos(#2)}; \toy={sin(#2)}; \toz={cos(#1)cos(#2)}; } }, sense/.style n args={3}{ % position, slant, length, color decoration={ markings, mark=at position #1 with {% \arrow{Stealth[length=#3, slant=#2]} } }, postaction=decorate } } \tikzmath{ real \fc, \T; \fc = .28pi; \T = 16pi; function F(\t) {return {sin(\fcdeg(\t))/\t};}; function G(\t) {return {.3(\t/\T +.2)};}; function H(\t) {return {cos(\fc*deg(\t))/\t};};
}

\begin{tikzpicture}[view={30}{10}, scale=5] \begin{scope}[gray, very thin, evaluate={% real \a, \b, \c, \r; \a = .8; \b = .6; \c = 1; \r = .7; }] \draw[->] (-\r.6\a, 0, 0) -- (\r\a, 0, 0) node[scale=.7, pos=1.03] {$x$}; \draw[->] (0, -\r\b, 0) -- (0, \r\b, 0); \draw[->] (0, 0, -\r\c) -- (0, 0, \r*\c); \end{scope}

\draw[variable=\t, domain=2:\T, samples=300, sense={.12}{1.5}{5}] plot ({F(\t)}, {G(\t)}, {H(\t)});

\draw[blue, variable=\t, domain=2:\T, samples=300, sense={.12}{1.5}{5}] plot ({F(\t)}, 0, {H(\t)});

\draw[variable=\t, domain=2:\T, samples=300, sense={.12}{-1.5}{5}] plot ({-H(\t)}, {-G(\t)}, {-F(\t)});
\end{tikzpicture} \end{document}

Daniel N
  • 5,687
  • Yes, the lower trajectories are strange, now I have corrected it. Thank you very much for your responses, I will play with your code a little to get a better grip of this kind of solution. Best regards – Fractal Admirer Nov 25 '22 at 14:41
  • I figured out a way of decorating the curves using the \addplot command. You only need to put the graph codes on the scope environment with the decorations defined and put postaction={decorate} inside the brackets. – Fractal Admirer Nov 25 '22 at 22:27