Drawing Pathways with Tikz

I had the need to draw a negative feedback around a linear pathway. Normally I would use a vector drawing packages to do this, such as Illustrator or Inkscape. This time I thought I would try the tikz package that allows one to embed diagrams inside LaTeX files in script form. The tikz manual is an excellent source of ideas and in one section they show how to draw syntax diagrams (Section 5, page 60). I re-purposed some of this code to draw the following pathway with a negative feedback:

NegFeedbackTikz

To draw this diagram I used the following code. The code is split into fours sections. The header and three coding sections. The first coding section places and names the four species nodes. Naming nodes is very used later on. The second section draws the reaction arrows and the final section draws the negative feedback loop. The header specifies the type of arrow that will be used, >=latex’ which is the latex arrow (See section 23, page 256 for more choices of arrows), and the distance between nodes. See the comments in the code to understand how the feedback loop was made.

\begin{tikzpicture}[>=latex', node distance=2cm]

\node (Xo) {\Large $X_o$};
\node [right of = Xo] (S1) {\Large $S_1$};
\node [right of = S1] (S2) {\Large $S_2$};
\node [right of = S2] (X1) {\Large $X_1$};

\draw [->,ultra thick,blue] (Xo) -- node[above, black] {$v_1$} (S1);
\draw [->,ultra thick,blue] (S1) -- node[above, black] {$v_2$} (S2);
\draw [->,ultra thick,blue] (S2) -- node[above, black] {$v_3$} (X1);

% Lets draw a line with a blunt end, -|
\draw [-|,ultra thick,blue]
% start in the middle of S2, and move down 2.75 mm 
% ($ ... $) notation is used to add the coordinates
($ (S2) + (0mm,-2.75mm) $)
% Now draw the line down by 3mm
% -- means draw to, + means move by 
-- +(0,-3mm)
% Now move back to the left of S2
% The symbol -| means draw horizontal then vertical. 
% If we used -- instead the line would be drawn 
% diagonally to the reaction edge.
% (S1) is the center of the node. But we want the
% blunt end to end below the S1 line and
% half way to the left. The 10mm is half the node
% distance of 2cm, and 1mm is slightly below  
% the reaction line.
-| ($ (S1) - (10mm,1mm) $);

\end{tikzpicture}
This entry was posted in General Interest, LaTeX, Pathways, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published.