tikz-gallery-aez
Figure 1
Keywords: barchart, plotting, axes, local variables
\documentclass[preview,varwidth=true]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} % Define a local variable \def\barWidth{0.8} \def\barYOffset{0.01} % Draw axes \draw[->] (0,-0.5) -- (0,4) node[right] {Value}; \draw[-] (-0.5,0) -- (3.0,0) node[right] {Item}; % Draw ticks and labels for the x-axis \foreach \x/\xtext in {0.5/a, 1.5/b, 2.5/c} { \draw (\x, 2pt) -- (\x, -2pt) node[below] {\xtext}; } % Draw ticks and labels for the y-axis \foreach \y in {1, 2, 3} { \draw (2pt, \y + \barYOffset) -- (-2pt, \y + \barYOffset) node[left] {\y}; } % Draw the bars \fill[red] (0.5-0.5*\barWidth,\barYOffset) rectangle ++(\barWidth,3); \fill[gray] (1.5-0.5*\barWidth,\barYOffset) rectangle ++(\barWidth,1); \fill[blue] (2.5-0.5*\barWidth,\barYOffset) rectangle ++(\barWidth,2); \end{tikzpicture} \end{document}
Figure 2
Keywords: barchart, plotting, axes, local variables
\documentclass[preview,varwidth=30.0cm]{standalone} \usepackage{tikz} % Optional PGF libraries \usetikzlibrary{arrows.meta} \usetikzlibrary{shapes.geometric} \usepackage{pgflibraryarrows} \usepackage{pgflibrarysnakes} \begin{document} \begin{tikzpicture} %% These parameters are used to adjust the scale and placement of %% the panels \def\yd{0.7} \def\xd{0.4} \def\yA{0.0} \def\yB{-7.0} \def\yC{-22.0} %% Draw rectangles some scaffold %% \draw[step=0.25cm,color=gray] (-1,\yC*\yd) grid (25*\xd,25*\yd); %% \draw (0,\yA*\yd) rectangle (0+25*\xd,\yA*\yd+14*\yd); %% \draw (0,\yB*\yd) rectangle (0+25*\xd,\yB*\yd+14*\yd); %% \draw (0,\yC*\yd) rectangle (0+25*\xd,\yC*\yd+14*\yd); %% \foreach \y in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14} { %% \draw (0,\y*\yd) node[left] {\y}; %% \draw (0,\yB*\yd+\y*\yd) node[left] {\y}; %% \draw (0,\yC*\yd+\y*\yd) node[left] {\y}; %% } %% \foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25} { %% \draw (\x*\xd,0) node[below] {\x}; %% \draw (\x*\xd,\yB*\yd) node[below] {\x}; %% \draw (\x*\xd,\yC*\yd) node[below] {\x}; %% } %% Panel labels %% ------------ \draw (-1*\xd,\yA*\yd + 14*\yd) node[font=\Large\bfseries\sffamily] {A}; \draw (-1*\xd,\yB*\yd + 5*\yd) node[font=\Large\bfseries\sffamily] {B}; \draw (-1*\xd,\yC*\yd + 9*\yd) node[font=\Large\bfseries\sffamily] {C}; %% Draw the vertical lines indicating the scheduled unsequenced sampling. %% ---------------------------------------------------------------------- \draw[dash pattern=on 3mm off 1mm, draw=black, line width=0.2mm] (5*\xd,-1*\yd) -- (5*\xd,7*\yd); \draw[dash pattern=on 3mm off 1mm, draw=black, line width=0.2mm] (13*\xd,1*\yd) -- (13*\xd,12*\yd); \draw[dash pattern=on 3mm off 1mm, draw=black, line width=0.2mm] (21*\xd,7*\yd) -- (21*\xd,13*\yd); %% Draw the horizontal lines for each lineage. %% ------------------------------------------- \draw[fill=black, draw=black, line width=1pt] (1*\xd,13*\yd) circle (1.5mm) node[right] {~~Sequenced sample}; \draw[fill=white, draw=black, line width=1pt] (1*\xd,12.3*\yd) circle (1.5mm) node[right] {~~Unsequenced sample}; \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (11*\xd,5.8*\yd) .. controls (14*\xd,5*\yd) .. (18*\xd,5*\yd) node[right] {$\lambda$-event}; \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (14*\xd,6.8*\yd) .. controls (16*\xd,5*\yd) .. (18*\xd,5*\yd); \draw[-,line width=1mm] (0*\xd,0*\yd) -- (5*\xd,0*\yd); \draw[fill=white, draw=black, line width=1pt] (5*\xd,0) circle (1.5mm); \draw[-,line width=1mm] (3*\xd,1*\yd) -- (10*\xd,1*\yd); \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (10.2*\xd,0.9*\yd) .. controls (12*\xd,0*\yd) .. (15*\xd,0*\yd) node[right] {$\mu$-event}; \draw[-,line width=1mm] (7*\xd,2*\yd) -- (13*\xd,2*\yd); \draw[fill=white, draw=black, line width=1pt] (13*\xd,2*\yd) circle (1.5mm); \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (13.5*\xd,1.8*\yd) .. controls (16*\xd,1*\yd) .. (19*\xd,1*\yd) node[right] {$\nu$-event}; \draw[-,line width=1mm] (12*\xd,3*\yd) -- (16*\xd,3*\yd); \draw[fill=black, draw=black, line width=1pt] (16*\xd,3*\yd) circle (1.5mm); \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (16.5*\xd,3.2*\yd) .. controls (19*\xd,4*\yd) .. (21*\xd,4*\yd) node[right] {$\psi$-event}; \draw[-,line width=1mm] (1*\xd,4*\yd) -- (13*\xd,4*\yd); \draw[fill=white, draw=black, line width=1pt] (13*\xd,4*\yd) circle (1.5mm); \draw[-,line width=1mm] (2*\xd,5*\yd) -- (6*\xd,5*\yd); \draw[fill=black, draw=black, line width=1pt] (6*\xd,5*\yd) circle (1.5mm); \draw[-,line width=1mm] (4*\xd,6*\yd) -- (13*\xd,6*\yd); \draw[fill=white, draw=black, line width=1pt] (13*\xd,6*\yd) circle (1.5mm); \draw[-,line width=1mm] (11*\xd,7*\yd) -- (18*\xd,7*\yd); \draw[->,line width=1mm, -{Stealth[length=5mm]}] (17*\xd,8*\yd) -- (25*\xd,8*\yd); \draw[->,line width=1mm, -{Stealth[length=5mm]}] (14*\xd,9*\yd) -- (25*\xd,9*\yd); \draw[-,line width=1mm] (9*\xd,10*\yd) -- (22*\xd,10*\yd); \draw[fill=black, draw=black, line width=1pt] (22*\xd,10*\yd) circle (1.5mm); \draw[-,line width=1mm] (8*\xd,11*\yd) -- (15*\xd,11*\yd); \draw[fill=black, draw=black, line width=1pt] (15*\xd,11*\yd) circle (1.5mm); \draw[->,line width=1mm, -{Stealth[length=5mm]}] (19*\xd,12*\yd) -- (25*\xd,12*\yd); %% \draw[-,line width=1mm] (20*\xd,13*\yd) -- (22*\xd,13*\yd); %% \draw[fill=black, draw=black, line width=1pt] (22*\xd,13*\yd) circle (1.5mm); %% Draw the vertical lines for each lineage. %% ----------------------------------------- \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (1*\xd,0*\yd) -- (1*\xd,4*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (2*\xd,4*\yd) -- (2*\xd,5*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (3*\xd,0*\yd) -- (3*\xd,1*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (4*\xd,5*\yd) -- (4*\xd,6*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (7*\xd,1*\yd) -- (7*\xd,2*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (8*\xd,6*\yd) -- (8*\xd,11*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (9*\xd,6*\yd) -- (9*\xd,10*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (11*\xd,6*\yd) -- (11*\xd,7*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (12*\xd,2*\yd) -- (12*\xd,3*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (14*\xd,7*\yd) -- (14*\xd,9*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (17*\xd,7*\yd) -- (17*\xd,8*\yd); \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (19*\xd,10*\yd) -- (19*\xd,12*\yd); %% \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (20*\xd,12*\yd) -- (20*\xd,13*\yd); %% Label the scheduled sampling times \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (13*\xd,8*\yd) .. controls (8*\xd,8*\yd) .. (5*\xd,10*\yd) node[anchor=south east, align=center] {Scheduled\\ sample times}; \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (5*\xd,7*\yd) .. controls (3*\xd,8*\yd) .. (5*\xd,10*\yd); %% Draw the time series. %% --------------------- \draw[->, line width=0.3mm, -{Stealth[length=1.5mm]}] (0.2*\xd, -4*\yd + \yB*\yd) -- (23*\xd, -4*\yd + \yB*\yd); \foreach \x in {1,4,5,6,8,13,15,16,21,22} { \draw (\x*\xd, -3.9*\yd + \yB*\yd) -- (\x*\xd, -4.1*\yd + \yB*\yd); } \draw[fill=white, draw=black, line width=1pt] (5*\xd,-3.4*\yd+\yB*\yd) circle (1.5mm); \draw (5*\xd,-2.5*\yd+\yB*\yd) node[font=\Large\bfseries\sffamily] {$1$}; %% \draw[fill=white, draw=black, line width=1pt] (13*\xd,-2.0*\yd+\yB*\yd) circle (1.5mm); %% \draw[fill=white, draw=black, line width=1pt] (13*\xd,-2.7*\yd+\yB*\yd) circle (1.5mm); %% \draw[fill=white, draw=black, line width=1pt] (13*\xd,-3.4*\yd+\yB*\yd) circle (1.5mm); \draw[fill=white, draw=black, line width=1pt] (13*\xd,-3.4*\yd+\yB*\yd) circle (2.6mm); \draw (13*\xd,-2.5*\yd+\yB*\yd) node[font=\Large\bfseries\sffamily] {$3$}; %% \draw[fill=white, draw=black, line width=1pt] (21*\xd,-3.4*\yd+\yB*\yd) circle (1.5mm); \draw (21*\xd,-3.4*\yd+\yB*\yd) node[font=\Large\bfseries\sffamily] {$\emptyset$}; \draw (21*\xd,-2.5*\yd+\yB*\yd) node[font=\Large\bfseries\sffamily] {$0$}; \draw (4*\xd,-2.5*\yd+\yB*\yd) node[left, align=center] {Time series\\ values}; %% Draw the reconstructed tree. %% ---------------------------- \draw (5*\xd,3.5*\yd+\yB*\yd) node[left, align=center] {Reconstructed\\ tree}; \draw[fill=black, draw=black, line width=1pt] (22*\xd,3*\yd+\yB*\yd) circle (1.5mm); \draw[fill=black, draw=black, line width=1pt] (15*\xd,2*\yd+\yB*\yd) circle (1.5mm); \draw[fill=black, draw=black, line width=1pt] (6*\xd,1*\yd+\yB*\yd) circle (1.5mm); \draw[fill=black, draw=black, line width=1pt] (16*\xd,0*\yd+\yB*\yd) circle (1.5mm); \draw[-, draw=black, line width=0.5mm] (22*\xd,3*\yd+\yB*\yd) -- (8*\xd,3*\yd+\yB*\yd) -- (8*\xd,2*\yd+\yB*\yd) -- (8*\xd,2*\yd+\yB*\yd) -- (15*\xd,2*\yd+\yB*\yd); \draw[-, draw=black, line width=0.5mm] (8*\xd,2.5*\yd+\yB*\yd) -- (4*\xd,2.5*\yd+\yB*\yd) -- (4*\xd,1*\yd+\yB*\yd) -- (6*\xd,1*\yd+\yB*\yd); \draw[-, draw=black, line width=0.5mm] (16*\xd,0*\yd+\yB*\yd) -- (1*\xd,0*\yd+\yB*\yd) -- (1*\xd,1.75*\yd+\yB*\yd) -- (4*\xd,1.75*\yd+\yB*\yd); %% Draw the axes and axes text. %% ---------------------------- \draw[->, line width=0.3mm, -{Stealth[length=1.5mm]}] (0*\xd, -0.2*\yd + \yC*\yd) -- (0*\xd, 8.0*\yd + \yC*\yd); \draw[->, line width=0.3mm, -{Stealth[length=1.5mm]}] (-0.2*\xd, 0*\yd + \yC*\yd) -- (25*\xd, 0*\yd + \yC*\yd); \foreach \y in {0,1,2,3,4,5,6,7} { \draw (-2pt,\y*\yd + \yC*\yd) -- (2pt,\y*\yd + \yC*\yd); \draw (-2pt,\y*\yd + \yC*\yd) node[left] {\y}; } %% Draw the prevalence curve and the LTT. %% -------------------------------------- \draw[->, draw=gray, line width=0.5mm, -{Stealth[length=3mm]}] (0*\xd, 1*\yd + \yC*\yd) -- (1*\xd, 1*\yd + \yC*\yd) -- (1*\xd, 2*\yd + \yC*\yd) -- (2*\xd, 2*\yd + \yC*\yd) -- (2*\xd, 3*\yd + \yC*\yd) -- (3*\xd, 3*\yd + \yC*\yd) -- (3*\xd, 4*\yd + \yC*\yd) -- (4*\xd, 4*\yd + \yC*\yd) -- (4*\xd, 5*\yd + \yC*\yd) -- (5*\xd, 5*\yd + \yC*\yd) -- (5*\xd, 4*\yd + \yC*\yd) -- (6*\xd, 4*\yd + \yC*\yd) -- (6*\xd, 3*\yd + \yC*\yd) -- (7*\xd, 3*\yd + \yC*\yd) -- (7*\xd, 4*\yd + \yC*\yd) -- (8*\xd, 4*\yd + \yC*\yd) -- (8*\xd, 5*\yd + \yC*\yd) -- (9*\xd, 5*\yd + \yC*\yd) -- (9*\xd, 6*\yd + \yC*\yd) -- (10*\xd, 6*\yd + \yC*\yd) -- (10*\xd, 5*\yd + \yC*\yd) -- (11*\xd, 5*\yd + \yC*\yd) -- (11*\xd, 6*\yd + \yC*\yd) -- (12*\xd, 6*\yd + \yC*\yd) -- (12*\xd, 7*\yd + \yC*\yd) -- (13*\xd, 7*\yd + \yC*\yd) -- (13*\xd, 4*\yd + \yC*\yd) -- (14*\xd, 4*\yd + \yC*\yd) -- (14*\xd, 5*\yd + \yC*\yd) -- (15*\xd, 5*\yd + \yC*\yd) -- (15*\xd, 4*\yd + \yC*\yd) -- (16*\xd, 4*\yd + \yC*\yd) -- (16*\xd, 3*\yd + \yC*\yd) -- (17*\xd, 3*\yd + \yC*\yd) -- (17*\xd, 4*\yd + \yC*\yd) -- (18*\xd, 4*\yd + \yC*\yd) -- (18*\xd, 3*\yd + \yC*\yd) -- (19*\xd, 3*\yd + \yC*\yd) -- (19*\xd, 4*\yd + \yC*\yd) -- (20*\xd, 4*\yd + \yC*\yd) -- %% (20*\xd, 5*\yd + \yC*\yd) -- %% (21*\xd, 5*\yd + \yC*\yd) -- (21*\xd, 4*\yd + \yC*\yd) -- (22*\xd, 4*\yd + \yC*\yd) -- (22*\xd, 3*\yd + \yC*\yd) -- (25*\xd, 3*\yd + \yC*\yd); \draw[dash pattern=on 3mm off 1mm, draw=black, line width=0.5mm] (1*\xd, 0*\yd + \yC*\yd) -- (1*\xd, 2*\yd + \yC*\yd) -- (4*\xd, 2*\yd + \yC*\yd) -- (4*\xd, 3*\yd + \yC*\yd) -- (6*\xd, 3*\yd + \yC*\yd) -- (6*\xd, 2*\yd + \yC*\yd) -- (8*\xd, 2*\yd + \yC*\yd) -- (8*\xd, 3*\yd + \yC*\yd) -- (15*\xd, 3*\yd + \yC*\yd) -- (15*\xd, 2*\yd + \yC*\yd) -- (16*\xd, 2*\yd + \yC*\yd) -- (16*\xd, 1*\yd + \yC*\yd) -- (22*\xd, 1*\yd + \yC*\yd) -- (22*\xd, 0*\yd + \yC*\yd); %% Create an indicator of the prevalence estimate. %% ----------------------------------------------- \node[ draw, star, minimum size=5mm, inner sep=0pt, star points=5, star point ratio=2.25 ] at (20*\xd, 5*\yd + \yC*\yd) {}; \draw[<-, line width=0.3mm, draw=darkgray, {Stealth[length=2.5mm]}-] (20.0*\xd, 5.5*\yd + \yC*\yd) .. controls (19*\xd, 7*\yd + \yC*\yd) .. (17.5*\xd, 7.5*\yd + \yC*\yd) node[left] {Prevalence estimate}; \end{tikzpicture} \end{document}
Figure 3
Keywords: diagram, model
\documentclass[preview,border=0.7cm,varwidth=10.8cm]{standalone} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{figure} \begin{tikzpicture}[ node/.style={rectangle, draw=black, minimum size=7mm}, ghost/.style={rectangle, minimum size=5mm}, arrow/.style={->} ] \def\dy{1.0} \def\dx{1.0} %% Guild liens %% \draw[step=0.5cm,color=gray] (-\dx,-\dy) grid (7*\dx,7*\dy); %% \foreach \n in {0,1,2,3,4,5,6,7} { %% \draw (0,\n*\dy) node[left] {\n}; %% \draw (\n*\dy,0) node[] {\n}; %% } % Nodes \node[node] at (2,3) (n) {$n$}; \node[node] at (6,3) (y) {$y$}; \node[ghost] at (0+0.15,3) () {$\alpha$}; \node[ghost] at (3-0.25,2) () {$\beta + \kappa y$}; \node[ghost] at (7-0.75,2) () {$\delta$}; \node[ghost] at (4,5) () {$\gamma$}; % Lines \draw[arrow] (2,3.4) .. controls (2,5) and (6,5) .. (6,3.4); \draw[arrow] (2,2.6) -- (2,1.5); \draw[arrow] (6,2.6) -- (6,1.5); \draw[arrow] (1.6,3.1) .. controls (0,5) and (0,1) .. (1.6,2.9); \end{tikzpicture} \end{figure} \end{document}
Figure 4
Keywords: diagram, model
\documentclass{standalone} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{positioning, fit, shapes.geometric} \begin{document} \begin{tikzpicture}[ latent/.style={circle,draw,minimum size=2em,inner sep=0pt}, observed/.style={latent,fill=gray}, post/.style={->,>=stealth,semithick}, plate/.style={rectangle,draw,inner sep=0.25cm}, function/.style={ellipse,draw,dashed,inner sep=0.1cm} ] \def\ya{4.0} \def\yb{2.5} \def\yc{1.0} % Nodes \node[latent] at (1, \ya) (alpha) {$\alpha$}; \node[latent] at (2, \ya) (beta) {$\beta$}; \node[latent] at (3, \ya) (gamma) {$\gamma$}; \node[latent] at (4, \ya) (delta) {$\delta$}; \node[function] at (2.5, \yb) (LK) {$\text{LK}_t$}; \node[observed] at (1.5, \yc) (H) {$H_t$}; \node[observed] at (3.5, \yc) (L) {$L_t$}; % Edges \draw[post] (alpha) -- (LK); \draw[post] (beta) -- (LK); \draw[post] (gamma) -- (LK); \draw[post] (delta) -- (LK); \draw[post] (LK) -- (H); \draw[post] (LK) -- (L); % Plates \node[plate, fit=(LK) (H) (L)] {}; \node at (3.5, \yc-0.8) {$t = 1:N$}; \end{tikzpicture} \end{document}
convert -density 300 -colorspace RGB -background white -alpha remove -alpha off input.pdf output.png
Figure 5
Keywords: SIR, diagram, compartmental model, fill
\documentclass[preview,border=0.2cm,varwidth=10.8cm]{standalone} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{arrows.meta} \begin{document} \begin{figure} \begin{tikzpicture}[ redNode/.style={rectangle, draw=red, fill=red!5, minimum size=7mm, rounded corners=2mm, line width=0.2mm}, blueNode/.style={rectangle, draw=blue, fill=blue!5, minimum size=7mm, rounded corners=2mm, line width=0.2mm}, grayNode/.style={rectangle, draw=darkgray, fill=darkgray!5, minimum size=7mm, rounded corners=2mm, line width=0.2mm}, node/.style={rectangle, draw=black, minimum size=7mm, rounded corners=2mm, line width=0.2mm}, ghost/.style={rectangle, minimum size=5mm}, arrow/.style={-{Latex[length=2mm]}, line width=0.2mm} ] \def\dy{1.0} \def\dx{0.7} %% Guild lines %% \draw[step=0.5cm,color=gray] (-\dx,-\dy) grid (7*\dx,7*\dy); %% \foreach \n in {0,1,2,3,4,5,6,7} { %% \draw (0,\n*\dy) node[left] {\n}; %% \draw (\n*\dy,0) node[] {\n}; %% } % Nodes \node[blueNode] at (\dx*1.0,1) (s) {$S$}; \node[redNode] at (\dx*3.5,1) (s) {$I$}; \node[grayNode] at (\dx*6.0,1) (s) {$R$}; % Lines \draw[arrow] (\dx*1.5, 1) .. controls (\dx*2.25-0.05,1.2) .. (\dx*3.0,1); \draw[arrow] (\dx*4.0, 1) .. controls (\dx*4.75-0.05,1.2) .. (\dx*5.5,1); \end{tikzpicture} \end{figure} \end{document}
Figure 6
Keywords: substitution model, diagram
\documentclass[preview,border=0.2cm,varwidth=10.8cm]{standalone} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{arrows.meta} \begin{document} \begin{figure} \begin{tikzpicture}[ node/.style={rectangle, draw=black, minimum size=7mm, rounded corners=3mm, line width=0.2mm}, arrow/.style={{Latex[length=1.5mm]}-{Latex[length=1.5mm]}, line width=0.1mm}, thickArrow/.style={{Latex[length=2.5mm]}-{Latex[length=2.5mm]}, line width=0.6mm} ] \def\dy{1.0} \def\dx{1.0} \def\buf{0.4} %% Guild lines %% \draw[step=0.5cm,color=gray] (-\dx,-\dy) grid (7*\dx,7*\dy); %% \foreach \n in {0,1,2,3,4,5,6,7} { %% \draw (0,\n*\dy) node[left] {\n}; %% \draw (\n*\dy,0) node[] {\n}; %% } % Nodes \node[node] at (\dx*1.0,\dy*1.0) () {$A$}; \node[node] at (\dx*3.0,\dy*1.0) () {$G$}; \node[node] at (\dx*1.0,\dy*3.0) () {$T$}; \node[node] at (\dx*3.0,\dy*3.0) () {$C$}; % Lines \draw[thickArrow] (\dx*1.0+\buf,\dy*1.0) -- (\dx*3.0-\buf,\dy*1.0); % A<->G \draw[arrow] (\dx*1.0,\dy*1.0+\buf) -- (\dx*1.0,\dy*3.0-\buf); % A<->T \draw[arrow] (\dx*1.0+0.8*\buf,\dy*1.0+0.8*\buf) -- (\dx*3.0-0.8*\buf,\dy*3.0-0.8*\buf); % A<->C \draw[arrow] (\dx*3.0-0.8*\buf,\dy*1.0+0.8*\buf) -- (\dx*1.0+0.8*\buf,\dy*3.0-0.8*\buf); %G--T \draw[arrow] (\dx*3.0,\dy*1.0+\buf) -- (\dx*3.0,\dy*3.0-\buf); %G--C \draw[thickArrow] (\dx*1+\buf,\dy*3.0) -- (\dx*3.0-\buf,\dy*3.0); \end{tikzpicture} \end{figure} \end{document}
Figure 7
Keywords: plotting, SIR, phylogeny
\documentclass[preview,border=0.2cm,varwidth=10.0cm]{standalone} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{arrows.meta} \begin{document} \begin{figure} \begin{tikzpicture} \def\dy{2.5} \def\dx{4.0} \def\ox{4.5} \draw[thick,-] (-0.1 * \dx, -0.1 *\dy) -- (-0.1* \dx, 1.2*\dy); \draw[thick,-] (\ox + 1.1 * \dx, -0.1 *\dy) -- (\ox + 1.1* \dx, 1.2*\dy); \draw[thick,-] (-0.1 * \dx, -0.1 *\dy) -- (\ox + 1.1* \dx, -0.1*\dy); \draw[thick,-] (-0.1 * \dx, 1.2 *\dy) -- (\ox + 1.1* \dx, 1.2*\dy); \draw[thick,-] (0,0) -- (\dx * 1.1,0) node[anchor=north west] {}; \draw[thick,-] (0,0) -- (0,\dy * 1.1) node[anchor=south east] {}; \draw[blue,thick] % PUT S CURVE DATA HERE! \draw[gray,thick] % PUT R CURVE DATA HERE! \draw[red,thick] % PUT I CURVE DATA HERE! \draw[red,thick] (\ox + 0.8 * \dx, 0.2 * \dy) -- (\ox + 0.1 * \dx, 0.2 * \dy) -- (\ox + 0.1 * \dx, 0.5 * \dy) -- (\ox + 0.375 * \dx, 0.5 * \dy); \draw[red,thick] (\ox + 0.575 * \dx, 0.4 * \dy) -- (\ox + 0.375 * \dx, 0.4 * \dy) -- (\ox + 0.375 * \dx, 0.7 * \dy) -- (\ox + 0.5 * \dx, 0.7 * \dy); \draw[red,thick] (\ox + 0.7 * \dx, 0.6 * \dy) -- (\ox + 0.5 * \dx, 0.6 * \dy) -- (\ox + 0.5 * \dx, 0.8 * \dy) -- (\ox + 0.975 * \dx, 0.8 * \dy); \fill[red] (\ox + 0.8 * \dx, 0.2 * \dy) circle (3pt); \fill[red] (\ox + 0.575 * \dx, 0.4 * \dy) circle (3pt); \fill[red] (\ox + 0.7 * \dx, 0.6 * \dy) circle (3pt); \fill[red] (\ox + 0.975 * \dx, 0.8 * \dy) circle (3pt); \end{tikzpicture} \end{figure} \end{document}
Where the curve data comes from the following script
library(deSolve) sir_model <- function(t, state, parameters) { S <- state[1] I <- state[2] R <- state[3] beta <- parameters["beta"] gamma <- parameters["gamma"] dS <- -beta * S * I dI <- beta * S * I - gamma * I dR <- gamma * I list(c(dS, dI, dR)) } initial_state <- c(S = 0.99, I = 0.01, R = 0) # Example initial conditions parameters <- c(beta = 1.5, gamma = 0.5) # Example parameters times <- seq(0, 10, by = 0.1) # Time sequence result <- as.data.frame( ode(y = initial_state, times = times, func = sir_model, parms = parameters) ) paste( sprintf("(dx * %.3f, dy * %.3f)", result$time / 10, result$S) , collapse = " -- ") paste( sprintf("(dx * %.3f, dy * %.3f)", result$time / 10, result$I) , collapse = " -- ") paste( sprintf("(dx * %.3f, dy * %.3f)", result$time / 10, result$R) , collapse = " -- ")
Figure 8
Keywords: gantt chart
\documentclass{standalone} \usepackage{pgfgantt} \begin{document} \begin{ganttchart}[ hgrid, vgrid, title/.style={fill=blue!20}, title label font=\bfseries\color{black}, bar/.style={fill=orange!50}, bar height=0.7, group right shift=0, group height=.3, y unit chart=0.8cm ]{1}{12} \gantttitle{Week}{12} \\ \gantttitlelist{1,...,12}{1} \\ \ganttgroup{Preparation}{1}{3} \\ \ganttbar{Choose recipe}{1}{1} \\ \ganttbar{Buy ingredients}{2}{2} \\ \ganttlinkedbar{Mix ingredients}{3}{3} \ganttnewline \ganttgroup{Baking}{4}{9} \\ \ganttbar{Preheat oven}{4}{4} \\ \ganttlinkedbar{Bake the cake}{5}{9} \ganttnewline \ganttgroup{Decoration}{10}{12} \\ \ganttbar{Cool the cake}{10}{10} \\ \ganttlinkedbar{Decorate the cake}{11}{12} \end{ganttchart} \end{document}