1

I have the following code

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows,calc,fit}
\usepackage{amsmath,bm,times}
\newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
\newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command

\begin{document}
% Define the layers to draw the diagram
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

% Define block styles used later

\tikzstyle{sensor}=[draw, fill=blue!20, text width=5em, 
    text centered, minimum height=3em,drop shadow]
\tikzstyle{ann} = [above, text width=8em, text centered]
\tikzstyle{wa} = [sensor, text width=10em, fill=red!20, 
    minimum height=7em, rounded corners, drop shadow]
\tikzstyle{sc} = [sensor, text width=13em, fill=red!20, 
    minimum height=10em, rounded corners, drop shadow]

% Define distances for bordering
\def\blockdist{2.3}
\def\edgedist{2.5}
\def\nodedist{1em}

\begin{tikzpicture}[scale=.8, transform shape]
\node (node1) [wa] {Block};
\path (node1.west)+(-3.2,-.28) node (text1) [ann] {Inputs};
\path [draw, ->] (text1.east) -- (node1.west);

\path (node1.south)+(0,-2) node (text2) [ann] {Output1};
\path [draw,->]   (node1.south)--(text2.north);

\path (node1.east)+(3.2,2.2) node (myNode1) [sensor] {Block1};
\path (myNode1.south)+(0,-1) node (myNode2) [sensor] {Block2};
\path (myNode2.south)+(0,-1) node (myNode3) [sensor] {Block3};
\path (myNode3.south)+(0,-1) node (myNode4) [sensor] {Block4};

\path [draw,->] (node1.east) -- (myNode1.west);
\path [draw,->] (node1.east) -- (myNode2.west);
\path [draw,->] (node1.east) -- (myNode3.west);
\path [draw,->] (node1.east) -- (myNode4.west);



\path (node1.east)+(8.5,0) node (text3) [ann] {Output2};

\path [draw,->] (myNode1.east) -- (text3.west);
\path [draw,->] (myNode2.east) -- (text3.west);
\path [draw,->] (myNode3.east) -- (text3.west);
\path [draw,->] (myNode4.east) -- (text3.west);



\end{tikzpicture}

\end{document}

The above code give me the following figure

enter image description here

As you can see the arrows are not looking good (it should be thicker to be clearly visible). Also I am not able to draw all the arrows properly at the right most point where all arrows are pointing to a single point. What will be the issue?

  • Not looking good is only relative. It will be easy for us to know how you want them to be like. – user11232 Apr 5 '15 at 8:45
  • @HarishKumar: Thanks for your comment. I have updated the question. – Sooraj Apr 5 '15 at 8:49
  • How about a helper coordinate west of Output 2 for joining all the lines and drawing one arrow from it to Output 2. If you want thicker arrows you could try >=triangle 45 in your path command. – moospit Apr 5 '15 at 8:52
6

Will you be happy with this?

\documentclass[border=4]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows,calc,fit,positioning}
\usepackage{amsmath,bm,times}
\newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
\newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command

\begin{document}
% Define the layers to draw the diagram
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

% Define block styles used later

\tikzset{sensor/.style={draw, fill=blue!20, text width=5em,
                          text centered, minimum height=3em,drop shadow},
         ann/.style = {align=center},
         wa/.style = {sensor, text width=10em, fill=red!20,
                          minimum height=7em, rounded corners, drop shadow},
         sc/.style = {sensor, text width=13em, fill=red!20,
                         minimum height=10em, rounded corners, drop shadow}
    }

% Define distances for bordering
\def\blockdist{2.3}
\def\edgedist{2.5}
\def\nodedist{1em}

\begin{tikzpicture}[scale=.8,>=latex]
\node[wa] (node1)  {Block};
\node[left= 1.25cm of node1,ann] (text1)  {Inputs};
\draw [thick,->] (text1.east) -- (node1.west);

\node[below= 1.25cm of node1,ann] (text2) {Output1};
\draw [thick,->]   (node1.south)--(text2.north);

\node[above right= 0.6cm and 1.5cm of node1,sensor] (myNode1) {Block1};
\node[above right= -1cm and 1.5cm of node1,sensor] (myNode2) {Block2};
\node[below right= -1cm and 1.5cm of node1,sensor] (myNode3) {Block3};
\node[below right= 0.6cm and 1.5cm of node1,sensor] (myNode4){Block4};

\draw[thick,->] (node1.east) to[in=180,out=20] (myNode1.west);
\draw[thick,->] (node1.east) to[in=180,out=5] (myNode2.west);
\draw[thick,->] (node1.east) to[in=180,out=-5] (myNode3.west);
\draw[thick,->] (node1.east) to[in=180,out=-20] (myNode4.west);



\node[ann] (text3) at ([xshift=4.2cm]$(myNode2)!0.5!(myNode3)$) {Output2};

\draw[thick,->] (myNode1.east) to[in=180,out=0] (text3);
\draw[thick,->] (myNode2.east) to[in=180,out=0] (text3);
\draw[thick,->] (myNode3.east) to[in=180,out=0] (text3);
\draw[thick,->] (myNode4.east) to[in=180,out=0] (text3);
\end{tikzpicture}

\end{document}

enter image description here

2

Is this any better? I have used stealth arrows and put the arrow heads out of the blocks 80% along the line rather than at the very end.

enter image description here

It's just a minor hack of your code:

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows,calc,fit,arrows,decorations.markings}
\tikzset{%
  ->-/.style={decoration={markings, mark=at position 0.8 with {\arrow{stealth}}},
              postaction={decorate}}
}
\usepackage{amsmath,bm,times}
\newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
\newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command


\begin{document}
% Define the layers to draw the diagram
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

% Define block styles used later

\tikzstyle{sensor}=[draw, fill=blue!20, text width=5em,
    text centered, minimum height=3em,drop shadow]
\tikzstyle{ann} = [above, text width=8em, text centered]
\tikzstyle{wa} = [sensor, text width=10em, fill=red!20,
    minimum height=7em, rounded corners, drop shadow]
\tikzstyle{sc} = [sensor, text width=13em, fill=red!20,
    minimum height=10em, rounded corners, drop shadow]

% Define distances for bordering
\def\blockdist{2.3}
\def\edgedist{2.5}
\def\nodedist{1em}

\begin{tikzpicture}[>=stealth,scale=.8, transform shape]
\node (node1) [wa] {Block};
\path (node1.west)+(-3.2,-.28) node (text1) [ann] {Inputs};
\path [draw, ->] (text1.east) -- (node1.west);

\path (node1.south)+(0,-2) node (text2) [ann] {Output1};
\path [draw,->]   (node1.south)--(text2.north);

\path (node1.east)+(3.2,2.2) node (myNode1) [sensor] {Block1};
\path (myNode1.south)+(0,-1) node (myNode2) [sensor] {Block2};
\path (myNode2.south)+(0,-1) node (myNode3) [sensor] {Block3};
\path (myNode3.south)+(0,-1) node (myNode4) [sensor] {Block4};

\path [draw,->-] (node1.east) -- (myNode1.west);
\path [draw,->-] (node1.east) -- (myNode2.west);
\path [draw,->-] (node1.east) -- (myNode3.west);
\path [draw,->-] (node1.east) -- (myNode4.west);



\path (node1.east)+(8.5,0) node (text3) [ann] {Output2};

\path [draw,->-] (myNode1.east) -- (text3.west);
\path [draw,->-] (myNode2.east) -- (text3.west);
\path [draw,->-] (myNode3.east) -- (text3.west);
\path [draw,->-] (myNode4.east) -- (text3.west);

\end{tikzpicture}

\end{document}
  • Thanks for the answer. I found the answer given by Harish Kumar more appealing. – Sooraj Apr 5 '15 at 20:23
  • @Sooraj I agree. Harish's answer is much better! – Andrew Apr 6 '15 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.