1

I was googling around of ways to generate a plot like this, but I don't know how to plot this vertically. Since I started with LaTeX 30 minutes ago.

This is a reference to the post where I got the initial idea for this:

I'm attaching a picture of what I'm trying to accomplish

commercial photography locations

1 Answers1

1

This is the code of this answer modified such that the strands go top down instead of left right.

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usepackage{xstring,calc}
\usetikzlibrary{calc,positioning}

\newlength{\NodeSize}

\tikzset{DNA Style/.style={minimum size=0.5cm, draw=gray, line width=1pt, inner sep = 2pt}}{}


\newcounter{ColumnCounter}% Prefix for node labels


\newlength{\CurrentXPos}
\newcommand*{\PreviousNode}{}%
\newcommand*{\DNASequence}[2][Mark]{%
    % https://tex.stackexchange.com/questions/12091/tikz-foreach-loop-with-macro-defined-list
    \def\Sequence{#2}%
    \def\PreviousNode{}%
    \foreach [count=\xi] \Label/\Color in \Sequence {%
        \IfStrEq{\Color}{}{\def\Color{white}}{}
        \edef\NodeName{#1-\arabic{ColumnCounter}}
        \IfStrEq{\PreviousNode}{}{%
            \node [DNA Style, fill=\Color, anchor=south west] (\NodeName) {\Label};
            \xdef\PreviousNode{\NodeName}%
        }{
            \node [DNA Style, fill=\Color, anchor=north west, yshift=\pgflinewidth] at (\PreviousNode.south west)(\NodeName) {\Label};
            \xdef\PreviousNode{\NodeName}%
        }
        \stepcounter{ColumnCounter}
    } 
}%

\begin{document}
\tikzset{note/.style={circle,draw,align=left}}
\begin{tikzpicture}[>=stealth]
    \DNASequence[cell]{ABCC/magenta!20,,,XYZ/violet!30,,ABC/green, G/blue!20,, G/cyan!30,,C/olive};
    \node[note] (note1) at ($(cell-3)+(2,0)$) {Observe\\this};
    \node[note] (note2) [below=of note1] {And this,\\too!};
    \draw[->] (note1) -- (cell-3);
    \draw[->] (note2) -- (cell-7);
\end{tikzpicture}
\end{document}
gernot
  • 49,614