4

enter image description here

I would like to draw this figure in tikz. This figure below is already in tikz, but I would like to develop the code.

  • 6
    Welcome to TeX - LaTeX! Please show us what code you have so far and be precise about where you have problems. – Andrew Swann Oct 20 '18 at 9:49
  • 1
    If you know that diagram was created with TikZ, have you tried asking whoever made it if you can see the code? – Torbjørn T. Oct 21 '18 at 14:17
12

Welcome to TeX.SE! Since this is your first question, here is some attempt to answer it. Please consider posting what you have tried in the future. (EDIT: closed the gaps and added the two missing annotations, thanks to Werner for reminding me.)

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\usetikzlibrary{decorations.markings}
\tikzset{midmark/.style n args={2}{postaction={decorate,decoration={markings,
mark=at position 0.5 with {\node[font=\tiny] at (0,#2) {#1};}}}}}
\begin{tikzpicture}[declare function={R(\x)=0.3+\x/360;}]
\draw[line width=5mm,green] 
node[below right,black,xshift=-3mm,yshift=6mm]{AVA}
plot[variable=\x,domain=65:321] (\x:{R(\x)})
node[above left,black,xshift=2mm,yshift=-2mm]{FVA};
\draw[line width=5mm,orange] plot[variable=\x,domain=320:452,samples=31] (\x:{R(\x)});
\draw[line width=5mm,red] plot[variable=\x,domain=450:551,samples=61] (\x:{R(\x)})
node[black,left]{AVE};
\draw[line width=5mm,blue] plot[variable=\x,domain=550:830,samples=71] (\x:{R(\x)})
node[black,left,yshift=2.5mm,xshift=2mm]{FVE};
%
\draw[thin,<->,midmark={$25^\circ$}{-5pt}] plot[variable=\x,domain=65:90] (\x:{R(\x)+0.2});
\draw[thin,<->,midmark={$50^\circ$}{5pt}] plot[variable=\x,domain=270:320] (\x:{R(\x)+0.2});
\draw[white,thin,<->,midmark={$80^\circ$}{7pt}] plot[variable=\x,domain=550:630] (\x:{R(\x)+0.2});
\draw[white,thin,<->,midmark={$20^\circ$}{-5pt}] plot[variable=\x,domain=810:830] (\x:{R(\x)-0.2});
%
\draw (0,-pi) node[below] {PMI} -- (0,pi) node[above] {PMS};
%
\end{tikzpicture}  
\end{document}

enter image description here

  • 3
    Awesome as usual :) – Diaa Oct 20 '18 at 14:37
  • How can one close the connections between the coloured segments? – Werner Oct 21 '18 at 16:55
  • @Werner By just adding 0.5 to the upper ends of all but the last domains or by increasing the numbers of samples or dialing smooth. As you probably know, plot (without the smooth option) just connects the points (whose number is given by samples) by straight lines. This is why the gaps arise: the slopes of the last segment of a plot and the first segment of the next plot do not coincide. – marmot Oct 21 '18 at 17:01
11

Edit: explanation of the method used to determine the nature of the spiral.

This curve is a spiral with two centers.

To determine this, I printed your image (my printer did not respect the original colors) then actually built with a ruler and compass the perpendicular bisector of the segment that cuts the small green curve on the left.

This allowed me to understand that this curve is a spiral with 2 centers. To find the second centre, I extended the separation lines of the green part with the other two. I was able to see that the distance between the 2 centers is 5 mm.

printed-spiral

It is constructed by drawing arcs of circles whose centre is alternately R and L which are 5mm apart.

spirale-construction

According to my measurements, the first circle has a radius of 5mm and therefore each of the others increases by 5mm.

First I built it this way with a line of normal thickness L and R are the centers of the arcs of the circle : enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
    [every node/.style={font=\footnotesize,inner sep=0pt,outer sep=1pt},
    >={Straight Barb[inset=3pt,angle=90:3pt]}]
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=.2mm](0,1)arc(90:65:5mm);
\draw[draw=green,line width=.2mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=.2mm](0,-1)arc(270:320:15mm)coordinate(a);
\draw[draw=orange,line width=.2mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=.2mm](0,2)arc(90:190:20mm)coordinate(b);
\draw[draw=blue,line width=.2mm](b)arc(-170:-90:20mm)coordinate(c);
\draw[draw=blue,line width=.2mm](c)arc(-90:90:25mm)coordinate(d);
\draw[draw=blue,line width=.2mm](d)arc(90:110:30mm);
\end{tikzpicture}
\end{document}

To build this spiral, it is therefore necessary to build arcs of a given center circle. Here to avoid having to recalculate these centers, I have named the points where the spiral ends (a), (b), (c) and (d).

To draw the arrows, I had to draw arcs of circles of known center and to do so, I used the technique indicated by @JonathanGratus in his answer here: Draw arc in tikz when center of circle is specified like this:

\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)

And finally, I placed the text separately.

spiral-final

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
    [every node/.style={font=\footnotesize,inner sep=0pt,outer sep=1pt},
    >={Straight Barb[inset=3pt,angle=90:3pt]}]
%\fill[green!50!black](0,0)circle(1pt)node[left]{L};
%\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,1)arc(90:65:5mm);
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:190:20mm)coordinate(b);
\draw[draw=blue,line width=6mm](b)arc(-170:-90:20mm)coordinate(c);
\draw[draw=blue,line width=6mm](c)arc(-90:90:25mm)coordinate(d);
\draw[draw=blue,line width=6mm](d)arc(90:110:30mm);

% arrows placement 
% from https://tex.stackexchange.com/a/453649/138900
\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[<->,white](0,0)+(190:22mm)arc(190:270:22mm)node[midway,above right,inner sep=0pt]{$80^\circ$};
\draw[<->,white](0,0)+(90:28mm)arc(90:110:28mm)node[midway,above,inner sep=1pt]{$20^\circ$};

% node placement 
\node[anchor=north west] at ([shift={(-.1,.5)}]65:2mm){AVA};
\node[above left]at([shift={(-5pt,5pt)}]a){FVA};
\node[anchor=east]at(190:23mm){AVE};
\draw[node font=\bf](0,-3)node[below]{PMI}--(0,4)node[above]{PMS};
\end{tikzpicture}
\end{document}

Edit : Just for fun, an animation that builds this spiral.

its code is not optimized.

spirale-animation

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}


%\begin{tikzpicture}
%\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
%\fill[green!50!black](0,0)circle(1pt)node[left]{L};
%\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};
%\end{tikzpicture}
\tikzset{every node/.style={font=\footnotesize,inner sep=0pt,outer sep=1pt},>={Straight Barb[inset=3pt,angle=90:3pt]}}
\foreach \a in {-90,-85,...,65}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};
\draw(0,5mm)--([shift={(0,5mm)}]\a:8mm);
%\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:\a:5mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}

}

\foreach \a in {70,75,...,90}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};
\draw(0,5mm)--([shift={(0,5mm)}]\a:8mm);
\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:\a:5mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {95,100,...,270}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw(0,0)--(\a:13mm);
\draw[draw=green,line width=6mm](0,1)arc(90:\a:10mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {275,280,...,320}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw(0,5mm)--([shift={(0,5mm)}]\a:18mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:\a:15mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {-35,-30,...,90}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};

\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw(0,.5)--([shift={(0,5mm)}]\a:18mm);
\draw[draw=orange,line width=6mm](a)arc(-40:\a:15mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {95,100,...,190}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:\a:20mm)coordinate(b);
\draw(0,0)--(\a:23mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {-165,-160,...,-90}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:190:20mm)coordinate(b);
\draw[draw=blue,line width=6mm](b)arc(-170:\a:20mm)coordinate(c);
\draw(0,0)--(\a:23mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {-85,-80,...,90}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:190:20mm)coordinate(b);
\draw[draw=blue,line width=6mm](b)arc(-170:-90:20mm)coordinate(c);
%\draw[<->,white](0,0)+(190:22mm)arc(190:270:22mm)node[midway,above right,inner sep=0pt]{$80^\circ$};
\draw[draw=blue,line width=6mm](c)arc(-90:\a:25mm)coordinate(d);
\draw(0,.5)--([shift={(0,5mm)}]\a:28mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {95,100,...,110}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:190:20mm);
\draw[draw=blue,line width=6mm](b)arc(-170:-90:20mm)coordinate(c);
%\draw[<->,white](0,0)+(190:22mm)arc(190:270:22mm)node[midway,above right,inner sep=0pt]{$80^\circ$};
\draw[draw=blue,line width=6mm](c)arc(-90:90:25mm)coordinate(d);
\draw[draw=blue,line width=6mm](d)arc(90:\a:30mm);
%\draw[<->,white](0,0)+(90:28mm)arc(90:110:28mm)node[midway,above,inner sep=1pt]{$20^\circ$};
\draw(0,0)--(\a:33mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}
\foreach \a in {115,120,...,270}{
\begin{tikzpicture}
\useasboundingbox(-2.5,-2.5)rectangle(3,3.5);
\fill[green!50!black](0,0)circle(1pt)node[left]{L};
\fill[green!50!black](0,5mm)circle(1pt)node[left]{R};

\draw[draw=green,line width=6mm](0,5mm)+(65:5mm)arc(65:90:5mm);
%\draw[<->] (0,.5)+(65:7mm) arc (65:90:7mm)node[shift={(9pt,6pt)}]{$25^\circ$};
\draw[draw=green,line width=6mm](0,1)arc(90:270:10mm);
\draw[draw=green,line width=6mm](0,-1)arc(270:320:15mm)coordinate(a);
%\draw[<->](0,.5)+(-90:17mm)arc(-90:-40:17mm)node[midway,above]{$50^\circ$};
\draw[draw=orange,line width=6mm](a)arc(-40:90:15mm);
\draw[draw=red,line width=6mm](0,2)arc(90:190:20mm);
\draw[draw=blue,line width=6mm](b)arc(-170:-90:20mm)coordinate(c);
%\draw[<->,white](0,0)+(190:22mm)arc(190:270:22mm)node[midway,above right,inner sep=0pt]{$80^\circ$};
\draw[draw=blue,line width=6mm](c)arc(-90:90:25mm)coordinate(d);
\draw[draw=blue,line width=6mm](d)arc(90:110:30mm);
%\draw[<->,white](0,0)+(90:28mm)arc(90:110:28mm);%node[midway,above,inner sep=1pt]{$20^\circ$};
\draw(0,0)--(\a:33mm);
\draw(0,-3)--(0,3.5);
\end{tikzpicture}
}

\end{document}
  • Did you change the title of the question? If so, how do you know that the OP wants a "spiral with two centers"? – marmot Oct 21 '18 at 14:04
  • @marmot Yes, I changed the title of the question because this curve is really a two-center spiral. To verify this, I printed the image attached by the OP and checked with a compass and a ruler by drawing mediators, which allowed me to verify the nature of this curve as well as its construction. – AndréC Oct 21 '18 at 14:29
  • Are you saying that my proposal does not match? (To me the results look almost identical.) I would actually refrain from making such drastic edits to questions without consulting the OP first. – marmot Oct 21 '18 at 14:32
  • @marmot I had not noticed that your solution did not correspond, I was convinced that you had also made a spiral with two centres without having taken the trouble to check, I am confused. I voted for your solution because it taught me a lot of things I didn't know yet. – AndréC Oct 21 '18 at 14:40
  • I believe that my solution (also) reproduces the OP's screen shot. I am not saying yours does not, but I am not sure if your construction mechanism is advantageous or precisely what the OP wants. Rather, I really believe one should consult the OP for that. – marmot Oct 21 '18 at 14:43

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.