I am creating a flowchart using the tikzpicture package.
Because I am short on space, I would like to draw an arrow from a path to a box.
Using this code below, I would like to have an arrow that start from the path between Kmeans and KGaussians and that would loop-back to Kmeans.
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=gray!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=gray!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em]
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (init) {User input};
\node [block, below of=init] (denoise) {denoise};
\node [block, below of=denoise] (Kmeans) {K means};
\node [block, below of=Kmeans] (KGaussians) {K Gaussians};
\node [block, below of=KGaussians] (output) {Output};
% Draw edges
\path [line] (init) -- (denoise);
\path [line] (denoise) -- (Kmeans);
\path [line] (Kmeans) -- (KGaussians);
\path [line] (KGaussians) -- (output);
\end{tikzpicture}
\end{document}
I am thinking of adding a command line that would look like:
\draw [arrow] (\path (Kmeans) -- (KGaussians)) |- (Kmeans);
Thanks!
block
,line
etc are defined.\draw[-latex']($(Kmeans)!.5!(KGaussians)$)--+(1.5,0)|-(Kmeans.east);
? You need to addcalc
to the list of\usetikzlibrary
for this to work.