2

Is there a package that would help me create a diagram such as the one below? The example diagram can be found in this PATHOCOM project proposal. It appears to be a combination of a Gantt and Sankey diagram. An example of how this can be drawn containing just "Aim 1", "Site", "Sampling" should be enough to get me started.

enter image description here

1 Answers1

3

enter image description here

Some comments I think a solution for the diagram you are looking for can be achieved using only the positioning library:

  • I organized all the elements of the drawing around the empty cell in the upper left corner, which is a node. On its corresponding row and column, all the elements are nodes, say labels and years respectively.
  • The style for a label node is leftn and for a year node is yearn.
  • The rectangles are created with the rectangle command using coordinates (x, y) induced by the nodes (x by years and y by labels).
  • The arrows (style to) use the same kind of coordinates; a pre action (to be traced in white) gives the pass under effect.
  • Note that for aesthetic reasons, when drawing a curved arrow, the starting point (constructed from nodes) must be slightly lowered.
  • At the beginning, there are three parameters controlling the width and hight of a label node and the number of years.

The code

\documentclass[11pt, margin=1cm]{standalone}

\usepackage{tikz} \usetikzlibrary{math, arrows.meta, positioning}

\begin{document}

\tikzmath{% real \w, \h; integer \N; \w = 6; \h = 2; \N = 6; } \tikzset{% leftn/.style={#1, minimum width=\w cm, minimum height=\h ex, anchor=west, inner xsep=0pt, inner ysep=1ex, text width=\w cm, scale=.85}, yearn/.style={minimum width=.5*\w cm, inner xsep=0pt, scale=.85, font=\bfseries}, to/.style={preaction={draw, white, line width=4.5pt, line cap=butt, arrows={-Latex[length=4pt, width=10pt]}}, #1, line width=3pt, line cap=butt, arrows={-Latex[length=3pt, width=8pt]}} } \begin{tikzpicture}[node distance = .9\baselineskip and 0pt, every node/.style={}]

%% North-West empty node \node[leftn, minimum height=\h ex] (NW) {};

%% year nodes \node[right=of NW.east, yearn] (y1) {Year 1}; \foreach \j [remember=\j as \i (initially 1)] in {2, 3, ..., \N}{% \node[right=of y\i.east, yearn] (y\j) {Year \j}; }

%% blue nodes 1 \node[below=of NW.south west, leftn={blue}] (nB1) {Site characterization}; \node[below=of nB1.west, leftn={blue}] (nB2) {Sampling & sequencing}; \node[below=of nB2.west, leftn={blue}] (nB3) {Sequence analysis};

\node[below=of nB3.west, leftn, minimum height=\h ex] (nS1) {};

%% red nodes 1 \node[below=of nS1.south west, leftn={red}] (nR1) {Resource development}; \node[below=of nR1.west, leftn={red}] (nR2) {Phenotyping}; \node[below=of nR2.west, leftn={red}] (nR3) {Joint GWA mapping}; \node[below=of nR3.west, leftn={red}] (nR4) {Genetic validation};

%% rectangles \foreach \k in {1, 3, ..., \N}{% \fill[blue!60!green!15] (nB1.north west -| y\k.west) rectangle (nR4.south west -| y\k.east); }

%% arrows \draw[to=blue] (nB1 -| y1.west) -- (nB1 -| y1.east); \draw[to=blue] ([yshift=-1.5pt] nB1 -| y1.270) to[out=270, in=180] (nB2 -| y1.east) -- (nB2 -| y3.east); \draw[to=blue] ([yshift=-1.5pt] nB2 -| y2.270) to[out=270, in=180] (nB3 -| y2.east) -- (nB3 -| y4.east);

\draw[to=red] ([yshift=-1.5pt] nB3 -| y3.270) to[out=270, in=180] (nR4 -| y4.east) -- (nR4 -| y6.east);

\draw[to=red] (nR1 -| y1.west) -- (nR1 -| y1.east); \draw[to=red] ([yshift=-1.5pt] nR1 -| y1.270) to[out=270, in=180] (nR2 -| y1.east) -- (nR2 -| y3.east); \draw[to=red] ([yshift=-1.5pt] nR2 -| y2.270) to[out=270, in=180] (nR3 -| y2.east) -- (nR3 -| y5.east); \end{tikzpicture} \end{document}

Daniel N
  • 5,687