2

I was wondering whether it was possible to draw something like the following in Latex. If so what kind of package do I need to use?

An example: Scheduled processes

Thanks!

Snowflake
  • 755
  • 7
  • 13
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. tikz is one possibility. pstricks and friends is probably another. What have you tried? – cfr Jun 25 '14 at 00:04
  • I don't use it, but there is a package pgf-umlsd that does some sort of process diagrams. Maybe it can do these... – Steven B. Segletes Jun 25 '14 at 01:57
  • I tried using Tikz, but I couldn't find a good example to fix the node after each other :( and space them properly. – Snowflake Jun 25 '14 at 05:23
  • The problem is more the spacing :(, I don't know how to do that yet in Tikz, maybe there is a bit friendlier package. I haven't used pgf-umlsd, but I will look into it. – Snowflake Jun 25 '14 at 05:44
  • I suggest using pgfgantt as demonstrated here: https://tex.stackexchange.com/questions/110742/how-to-draw-a-scheduling-scheme – Stand with Gaza Mar 14 '22 at 21:20

1 Answers1

2

You can start with TiKZ and something like

\documentclass[tikz,border=2mm]{standalone}

\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[x=1cm, y=-1mm, font=\sffamily, >=Latex,
    burst/.style 2 args={draw,rounded corners,anchor=north west, minimum width=1cm, 
                         minimum height=#2mm, name=n#1, node contents=$n_{#1}$, inner sep=0pt}]

\draw (0,0) -- (0,90);
\foreach \i in {0,10,20,...,90}
    \draw (0,\i) node[left] {\i}--++(0:.3);

\foreach \i [count=\p] in {1,3,5}
{
\draw[dashed] (\i,0) rectangle ++(1,90);
\node[above,xshift=0.5cm] at (\i,0) {P\p};
}

\path (1,28) node[burst={2}{12}];
\path (1,57) node[burst={8}{7}];

\foreach \i/\j/\k in {4/8/18, 6/18/26,9/12/55,10/6/74}
    \path (3,\k) node[burst={\i}{\j}];

\foreach \i/\j/\k in {1/10/0, 3/20/10,5/8/30,7/12/38}
    \path (5,\k) node[burst={\i}{\j}];

\draw[->] (n1.south west) to[out=190,in=60] (n2.north east);
\draw[->] (n1.south west) -- (n4.north east);
\draw[->] (n1.south west) -- (n6.north east);
\draw[->] (n7.south west) -- (n10.north east);
\draw[->] (n4.south west) -- (n8.north east);
\draw[->] (n6.south west) -- (n8.north east);
\draw[->] (n2.south east) -- (n9.north west);
\draw[->] (n8.south east) -- (n10.north west);
\end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588