2

I want to create a figure like the following one using TikZ nodes, but I don't really know how... any help over here to get me started?

This would be the figure to reproduce:

fig

  • 4
    To get you started, my best advice would be to study the very detailed and explanatory tutorials in Part I Tutorials and Guidelines (pp. 28 sqq.) of the PGF manual. – ebosi Jan 31 '17 at 9:01
  • Well, what can you do, and what is hard? You seem to know some TikZ already. Look at the various shape libraries in the manual and you'll find both an ellipse shape and an arrow shape, which would help with the grey ellipses and the red arrows. – Torbjørn T. Jan 31 '17 at 9:57
9

Here is a starting point. The colours are awful, labels are missing, but probably only you know how the details should look like.

enter image description here

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}
\begin{document}
\tikzset
  {typeX/.style={ellipse,very thick,fill=white},
   typeA/.style={typeX,draw=violet},
   typeB/.style={typeX,draw=green},
  }
\newcommand\labeledarrow[3]%
  {\draw[-triangle 90,line width=1mm,draw=green,postaction={draw,-,line width=4mm,shorten >=3mm}]
     (#1) -- (#2);
   \draw[-triangle 90,line width=0.7mm,draw=orange,postaction={draw,-,line width=3.5mm,shorten >=2mm}]
     ($(#1)!0.05!(#2)$) -- node[pos=0.4]{#3} ($(#2)!0.05!(#1)$);
  }
\begin{tikzpicture}
  \begin{scope}[x=0.1mm]
    % stripe for background
    \draw[fill=magenta,magenta] (-10,0) rectangle (1510,1);
    % scale
    \foreach \x in {0,250,...,1500}
      \draw (\x,0) -- (\x,-0.2) node[below] {\x};
    % elliptic nodes
    \foreach \x/\v/\s in
      {  50/1/typeA,
        150/2/typeA,
        450/3/typeA,
        600/4/typeB,
        850/5/typeB,
       1050/6/typeA,
       1150/7/typeA,
       1300/8/typeA,
       1400/9/typeA%
      }
      \node[\s] at (\x,0.5) {V\v};
    % arrows
    \labeledarrow{550,1.5}{650,1.5}{V4F}
    \labeledarrow{900,-0.5}{800,-0.5}{V5R}
  \end{scope}
  \draw[->,line width=1mm] (7.5,-1.5) -- (7.5,-2.5);
  \begin{scope}[shift={(1,-4)}]
    \draw[line width=2mm,violet] (0,0) -- (3,0);
    \draw[line width=2mm,olive ] (3,0) -- (10,0);
    \draw[line width=2mm,violet] (10,0) -- (13,0);
    \draw[line width=2mm,violet] (0,0.5) -- (3,0.5);
    \draw[line width=2mm,olive ] (3,0.5) -- (10,0.5);
    \draw[line width=2mm,violet] (10,0.5) -- (13,0.5);
    \node at (6.5,0.25) {16S region};
    \draw[violet,line width=2mm] (-0.7,1.7) -- (0,1) -- (1,1);
    \draw[violet,-triangle 45, line width=1mm] (1.2,1) -- (1.3,1);
    \draw[violet,line width=2mm] (14.4,-1.9) -- (13,-0.5) -- (12,-0.5);
    \draw[violet,-triangle 45, line width=1mm] (11.8,-0.5) -- (11.7,-0.5);
    \draw[cyan,line width=2mm] (13.7,-1.2) -- (13,-0.5);
  \end{scope}
\end{tikzpicture}
\end{document}
  • you should charge him for doing his work :) – Boern Jan 31 '17 at 13:19
  • 1
    @Boern Well, I needed a break, and it was fun. Other people have facebook and Sudoku, we have TeX.SX ... – gernot Jan 31 '17 at 13:39
  • nice attitude ! (and nice code btw) – Boern Jan 31 '17 at 13:42
  • Many many thanks! I got frustrated and left it for tomorrow to at least come up with a working example... and I saw this! you saved me hours of hair pulling – DaniCee Jan 31 '17 at 14:09

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.