TransWikia.com

not able to get two flow charts side by side

TeX - LaTeX Asked by Asma Javaid on March 16, 2021

Hi All if any one can help me. I am using Latex first time. I have to add 2 flow chart side by side. But the code which I write prints the chart side by side but my second table of both charts are connected moreover they are not completely separate. does any one can help me how I can have complete separate side by side table I added the code as well which I used to compile this pdf in the pic.

complied image

 documentclass[a4paper,10pt]{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{matrix,shapes,arrows,positioning,chains}
usetikzlibrary{shapes.geometric, arrows}



usetikzlibrary{shapes.geometric, arrows, shadows}
begin{document}
begin{figure}
centering
tikzstyle{startstop} = [trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow]
tikzstyle{startstop} = [trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow]

tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
tikzstyle{arrow} = [thick,->,>=stealth]
tikzstyle{line} = [draw, -latex']



begin{tikzpicture}[node distance=2cm, auto]
begin{scope}[local bounding box=left]

node (start) [startstop] {Start};
node (in1) [io, below of=start] {CovidNon-Covid data};
node (pro1) [process, below of=in1] {Feature extraction};
node (in3) [process, below of=pro1] {Feature selection};

%node (pro2b) [process, right of=dec1, xshift=2cm] {};
node (out1) [io, below of=in3] {classifier};
node (stop) [startstop, below of=out1] {Results};

draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);

draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);

end{scope}
draw[color=gray,thick](left.south west) rectangle (left.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]left.south) {flow 1 label};
begin{scope}[local bounding box=right,xshift=6cm] 


node (start) [startstop] {Start};
node (in1) [io, below of=start] {Covid/Non-Covid data};
node (pro1) [process, below of=in1] {Feature extraction};
node (in3) [process, below of=pro1] {Feature selection};

%node (pro2b) [process, right of=dec1, xshift=2cm] {};
node (out1) [io, below of=in3] {classifier};
node (stop) [startstop, below of=out1] {Results};

draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);

draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);
 % % % % % % % % % % % % % % % %      
end{scope}
draw[color=gray,thick](right.south west) rectangle (right.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]right.south) {flow 2 label};

end{tikzpicture}


end{figure}



end{document}

One Answer

  • You can use the trapezium stretches=true option to save some space, then both diagrams will fit sie-by-side

  • is a special character in latex that indicates the start of macro names. You must not use it in text. To print a use textbackslash.


documentclass[a4paper,10pt]{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{matrix,shapes,arrows,positioning,chains}
usetikzlibrary{shapes.geometric, arrows}



usetikzlibrary{shapes.geometric, arrows, shadows}
begin{document}
begin{figure}
centering
tikzstyle{startstop} = [trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow]
tikzstyle{startstop} = [trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow]

tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=blue!30,trapezium stretches=true]
tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
tikzstyle{arrow} = [thick,->,>=stealth]
tikzstyle{line} = [draw, -latex']



begin{tikzpicture}[node distance=2cm, auto]
begin{scope}[local bounding box=left]

node (start) [startstop] {Start};
node (in1) [io, below of=start] {Covidtextbackslash Non-Covid data};
node (pro1) [process, below of=in1] {Feature extraction};
node (in3) [process, below of=pro1] {Feature selection};

%node (pro2b) [process, right of=dec1, xshift=2cm] {};
node (out1) [io, below of=in3] {classifier};
node (stop) [startstop, below of=out1] {Results};

draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);

draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);

end{scope}
draw[color=gray,thick](left.south west) rectangle (left.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]left.south) {flow 1 label};
begin{scope}[local bounding box=right,xshift=6cm] 


node (start) [startstop] {Start};
node (in1) [io, below of=start] {Covid/Non-Covid data};
node (pro1) [process, below of=in1] {Feature extraction};
node (in3) [process, below of=pro1] {Feature selection};

%node (pro2b) [process, right of=dec1, xshift=2cm] {};
node (out1) [io, below of=in3] {classifier};
node (stop) [startstop, below of=out1] {Results};

draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);

draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);
 % % % % % % % % % % % % % % % %      
end{scope}
draw[color=gray,thick](right.south west) rectangle (right.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]right.south) {flow 2 label};

end{tikzpicture}


end{figure}



end{document}

enter image description here

These are two slight modifications which really use positioning and/or chains.

documentclass[a4paper,10pt]{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{arrows,chains,positioning,shadows,shapes.geometric}
begin{document}
begin{figure}
centering
tikzset{startstop/.style={trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow},
startstop/.style={trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow},
io/.style={trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=blue!30,trapezium stretches=true},
process/.style={rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30},
decision/.style={diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
arrow/.style={thick,->,>=stealth},
line/.style={draw, -latex'}}
%
begin{tikzpicture}[node distance=1cm, auto]
begin{scope}[local bounding box=left]
node (start) [startstop] {Start};
node (in1) [io, below=of start] {Covidtextbackslash Non-Covid data};
node (pro1) [process, below=of in1] {Feature extraction};
node (in3) [process, below=of pro1] {Feature selection};
node (out1) [io, below=of in3] {classifier};
node (stop) [startstop, below=of out1] {Results};
draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);
draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);
end{scope}
draw[color=gray,thick]([xshift=-1ex,yshift=-1ex]left.south west) 
    rectangle ([xshift=1ex,yshift=1ex]left.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]left.south) {flow 1 label};
%
begin{scope}[local bounding box=right,xshift=6cm] 
node (start) [startstop] {Start};
node (in1) [io, below=of start] {Covid/Non-Covid data};
node (pro1) [process, below=of in1] {Feature extraction};
node (in3) [process, below=of pro1] {Feature selection};
node (out1) [io, below=of in3] {classifier};
node (stop) [startstop, below=of out1] {Results};
draw [arrow] (start) -- (in1);
draw [arrow] (in1) -- (pro1);
draw [arrow] (pro1) -- (in3);
draw [arrow] (in3) -- (out1);
draw [arrow] (out1) -- (stop);
 % % % % % % % % % % % % % % % %      
end{scope}
draw[color=gray,thick]([xshift=-1ex,yshift=-1ex]right.south west) 
    rectangle ([xshift=1ex,yshift=1ex]right.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]right.south) {flow 2 label};
end{tikzpicture}
end{figure}


begin{figure}
centering
tikzset{startstop/.style={trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow},
startstop/.style={trapezium, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30, drop shadow},
io/.style={trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=blue!30,trapezium stretches=true},
process/.style={rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30},
decision/.style={diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
arrow/.style={thick,->,>=stealth},
line/.style={draw, -latex'}}
%
begin{tikzpicture}[node distance=1cm, auto]
begin{scope}[local bounding box=left]
 path[start chain=going below,join=by arrow, nodes={on chain,join}]
   node (start) [startstop] {Start}
   node (in1) [io] {Covidtextbackslash Non-Covid data}
   node (pro1) [process] {Feature extraction}
   node (in3) [process] {Feature selection}
   node (out1) [io] {classifier}
   node (stop) [startstop] {Results};
end{scope}
draw[color=gray,thick]([xshift=-1ex,yshift=-1ex]left.south west) 
    rectangle ([xshift=1ex,yshift=1ex]left.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]left.south) {flow 1 label};
begin{scope}[local bounding box=right,xshift=6cm] 
 path[start chain=going below,join=by arrow, nodes={on chain,join}]
  node (start) [startstop] {Start}
  node (in1) [io] {Covid/Non-Covid data}
  node (pro1) [process] {Feature extraction}
  node (in3) [process] {Feature selection}
  node (out1) [io] {classifier}
  node (stop) [startstop] {Results};
 % % % % % % % % % % % % % % % %      
end{scope}
draw[color=gray,thick]([xshift=-1ex,yshift=-1ex]right.south west) 
    rectangle ([xshift=1ex,yshift=1ex]right.north east);
node[anchor=north,font=bfseries] at ([yshift=-2em]right.south) {flow 2 label};
end{tikzpicture}
end{figure}
end{document}

enter image description here

Answered by samcarter_is_at_topanswers.xyz on March 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP