0

I am trying to draw the "twisted" curve in the pic:

enter image description here

I am not an expert in Tikz, and I have written the following latex code:

\documentclass{standalone}
\pagestyle{empty}
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.markings}  %% Add decoration library
%\usetikzlibrary{knots}
%\renewcommand{\baselinestretch}{2}
 \pagestyle{plain}

 \begin{document}




% SET ARROW STYLE WITH TIP IN THE MIDDLE OF THE LINE
\tikzset{->-/.style={decoration={
            markings,
            mark=at position -0.3 with {\arrow{>}}},postaction={decorate}}}
        
        
\tikzset{line/.style={->,shorten <=0.4cm,shorten >=0.4cm}}

\centering
\resizebox{\textwidth}{!}{% 
    
    \begin{tikzpicture}[auto, node distance=5cm,>=latex']
        
        % DRAW AXIS
        \draw[->](-2,0)--(3,0);
        \draw[->](0,-2)--(0,4);
        \node at(3.2,0)(x){\large$x$};
        \node at(0.25,4)(xy){\large$\dot{x}$};
        
        % DRAW CURVES
        \draw[->-] (0,3) .. controls (-0.001,2)  and (1.9,-1) .. (0,-0.5);
        \draw[-] (0,-0.5) .. controls (-0.1,-0.08) and (-0.3,-0.2)  .. (-0.25,0);
        \draw[-] (-0.25,0) .. controls (-0.1,0.4) and (0,0)  .. (0.05,0);
        \draw[-] (0.05,0) .. controls (0.1,-0.2) and (0.05,-0.2)   .. (0,-0.03);
        
        \node at(0.2,0.2)(x){\large$0$};
        
        

    \end{tikzpicture}
    }%
    \end{document}

but what I get is something a little bit different from what I want:enter image description here

I could improve my code? Thank you!

2

I modified slightly your code. There were unneeded commands that I erased and I modified the points of the curve to fit the model. enter image description here

Notation remark. 0 is a real number. I think you need the letter O to denote the origin.

The code:

\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, decorations.markings}

\begin{document}

% SET ARROW STYLE WITH TIP IN THE MIDDLE OF THE LINE
\tikzset{%
  ->-/.style={%
    decoration={
      markings,
      mark=at position .65 with {\arrow[scale=1.2]{stealth}}
    },
    postaction={decorate}
  },
  >=stealth
}


\begin{tikzpicture}
  % DRAW AXIS
  \draw[->] (-1, 0) -- (2, 0) node[above right] {$x$};
  \draw[->] (0, -1.5) -- (0, 4) node[left] {$\dot{x}$};

  % DRAW CURVE
  \draw[blue, thick, ->-] (0, 3)
  to[out=270, in=90] (1, 0)
  .. controls +(0, -.4) and (.8, -1.1) .. (.4, -1.1)
  .. controls +(-.2, 0) and (0, -.8) .. (0, -.5)
  .. controls +(0, .3) and (-.2, -.2) .. (-.2, 0)
  .. controls +(0, .2) and (0, .25) .. (0, 0);

  \path (0, 0) node[above right] {$O$};
\end{tikzpicture}

\end{document}
3
  • Thank you so much, Daniel. I really appreciated your help. Just a question, which is the meaning of plus sign after thr controls commands? – michele_ub Oct 17 '20 at 20:05
  • My pleasure. As for +(a,b), it represents a relative coordinate with respect to the previous point; if the previous point is (x,y), then its significance is (x,y)+(a,b). In fact, I should have written ++(a,b), but in this case, it makes no difference. – Daniel N Oct 17 '20 at 21:37
  • Ok, now everything is clear! – michele_ub Oct 17 '20 at 22:17

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.