1

I am trying to do the following using Tikz code adapted from my previous Question1 and Question2 The code I am modifying credits to @Zarko:

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                decorations.pathreplacing,calligraphy,
                positioning,
                quotes,
                shapes.geometric
                }
\begin{document}
\begin{center}

\begin{tikzpicture}[auto, node distance = 6mm and 15mm, start chain = A going below, arr/.style = {-Stealth}, every edge/.style = {draw, arr}, BC/.style = {decorate, % Brace Calligraphic decoration={calligraphic brace, amplitude=3mm, raise=1mm, mirror}, very thick, pen colour={black} }, box/.style = {draw, rounded corners, fill=blue!20, align=center, minimum height=4em, text width=6em}, decision/.style = {diamond, aspect=1.5, draw, fill=blue!20, inner xsep=-3pt, text width=5.4em, align=center}, ] ellipse/.style = { ellipse, aspect=1.5,draw, fill=blue!20, inner xsep=-3pt, text width=5.4em, align=center}, ] % nodes \begin{scope}[nodes={on chain=A, join=by arr}] \node [ellipse] {Initiate}; % name=A-1 \node [box] { Program Kernel}; \node [box] {Data Distribution}; \node [box] {Accept $S_{n+1}$}; \node [box] {$T_{n+1} = K(T_n)$ and $n=n+1$}; \node [decision] {Stop?}; % A-6 \end{scope} % nodes in right column \node [box, right=of A-2] (rej) {Prior Data}; \node [box, at={(A-6 -| rej)}] (stop) {Stop}; % edge labels and connections not considered in join macro \path

    (A-6)   edge ["yes"]  (stop);

\draw[arr] (rej) -- node[auto] {$D_1$} (A-2); \draw[arr] (A-6.west) to ["no" '] ++(-1,0) |- (A-2); % braces \draw[BC] ([xshift=-12mm] A-1.north west) coordinate (aux) -- node[midway,left=5mm]{Stage 1} (aux |- A-4.south); \draw[BC] (aux |- A-5.north) -- node[midway,left=5mm]{Stage 2} (aux |- A-6.south); \end{tikzpicture} \end{center} \end{document}

enter image description here

However, I am unable to get the circle in the start despite adding ellipse in the styling and adding multiple nodes in horizontal with small circles showing n-blocks inbetween. The following is what I am trying to achieve.

enter image description here

gfdsal
  • 169
  • 1
    :-), you give me credits for used code in your question, however you not accept my answer, where I propose it ;-). You actually ask two question. The first is already solved by @Alenanno answer, the second request is to draw new image for you almost from scratch ... – Zarko Oct 22 '20 at 15:05
  • @Zarko, i had accepted other answer even before you answered, I didnt know that I could change it. Since, I use your code so I gave you the credit :) – gfdsal Oct 22 '20 at 15:32
  • @Zarko The second part is where I am struggling, the three boxes for "Processor 1, Processor 2..Processor 3" are not coming up properly and I wanted to add three tiny dots between "Processor 1 and Processor 2" which needs spacing so im not sure how to do. – gfdsal Oct 22 '20 at 15:34
  • @Zarko done :) selected the answer. – gfdsal Oct 22 '20 at 15:43

2 Answers2

2

It is not advisable to name the style exactly as the name of the shape, TikZ will not be able to distinguish between the two. So you should change ellipse to something else, as this name already identifies the shape itself.

Your issue is easily solved by moving the style out of the tikzpicture options and into a \tikzset like so:

\tikzset{
    elli/.style={ellipse, aspect=1.5,draw, fill=blue!20,
                    inner xsep=-3pt, text width=5.4em, align=center},
}

And this is the result:

enter image description here

Alenanno
  • 37,338
1

A rude complete solution:

enter image description here

There exist more elegant code ...

\documentclass{ieeetran}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                decorations.pathreplacing,calligraphy,
                fit,
                positioning,
                quotes,
                shapes.geometric
                }
\makeatletter
\tikzset{
    suspend join/.code = {\def\tikz@after@path{}}
        }
\makeatother
\usepackage{lipsum}

\begin{document} \lipsum[11] \begin{figure}[ht] \centering \begin{tikzpicture}[auto, node distance = 3mm and 2mm, start chain = A going below, arr/.style = {-Stealth}, every edge/.style = {draw, arr}, BC/.style = {decorate, % Brace Calligraphic decoration={calligraphic brace, amplitude=2mm, raise=1mm, mirror}, very thick, pen colour={black} }, box/.style = {draw, rounded corners, fill=blue!20, align=center, minimum height=5ex, text width=#1}, box/.default = 5.5em, decision/.style = {diamond, aspect=1.5, draw, fill=blue!20, inner xsep=-3pt, minimum width=5.4em, align=center}, ellip/.style = { ellipse, aspect=1.5,draw, fill=blue!20, inner xsep=-3pt, text width=5.4em, align=center}, ] % nodes in chain \begin{scope}[nodes={on chain=A, join=by arr}] \node [ellip] {Initiate}; % name=A-1 \node [box] {Program Kernel}; \node [box] {Data Distribution}; \node [suspend join, font=\bfseries, below=12mm] {\dots}; % A-4 \end{scope} % nodes in the left column \node [box=4em, left=of A-4] (p2) {Procesor 2}; \node [box=4em, left=of p2] (p1) {Procesor 1}; % nodes in the right column \node [box=4em, right=of A-4] (pn) {Procesor $n$}; % nodes in the main column \node [box, fit=(p1) (pn), below right=8mm and 0mm of p1.south west, label=center:Main server] (ms) {}; \node [decision, below=of A-4 |- ms.south] (ptc) {Packet Transfer\ Complete?}; % nodes in the left \node [box=4em, at={(p1 |- A-2)}] (ld) {Load Data}; \node [box, at={(p1 |- ptc)}] (stop) {Continue}; % edge labels and connections not considered in join macro \draw[arr] (ld) to["$D_1$"] (A-2); \foreach \i in {p1, p2, pn} { \draw[arr] (A-3) -- (\i); \draw[arr] (\i) -- (\i |- ms.north); } \draw[arr] (ms.south -| ptc) to (ptc); \draw[arr] (ptc) to["no" '] (stop); \draw[arr] (ptc.east) to ["yes"] ++(1,0) |- (A-2); % braces \draw[BC] (p1.north west) -- node[left=3mm]{Stage 2} (p1.south west); \draw[BC] (p1.west |- ld.north) -- node[left=3mm]{Stage 1} (A-3.south -| ms.west);

\end{tikzpicture} \end{figure} \lipsum \end{document}

Zarko
  • 296,517
  • Wow! Its not rude solution! Its exactly what I wanted! The only thing is that the arrow on the right connecting "packet transfer to program kernel" is out of the page, its going out of view – gfdsal Oct 22 '20 at 21:39
  • @gfdsal, I use default page layout defined by scrartcl document class and there is not out of text area, it is nice centered in it. Similar result I obtain at article document class. How you include this image in your document? – Zarko Oct 22 '20 at 21:45
  • you not mentioned, that your document has two columns and that your image you like have in one column ... see edited answer (aap) – Zarko Oct 22 '20 at 21:55
  • 1
    Sorry, i haven't installed ieeeconf document class. If it have different page layout as ieeetran than possible solution is to use figure* without positioning options instead of figure . Than figure will occupy both column but it will appear on the top of the next page. – Zarko Oct 22 '20 at 22:10
  • It works AMAZING! Thanks a lot! :) – gfdsal Oct 22 '20 at 22:12