Tikzpicture
I have graph and small group. Trouble is. How create arrow from container AND from objects to objects?
Tikzpicture
I have graph and small group. Trouble is. How create arrow from container AND from objects to objects?
luatex, is there some problem related to it?join=by -Stealth and by \draw[-Stealth] (node i) to ["opis"] (node j)mwe for above image:
\documentclass[ tikz, border=3mm]{standalone}
%---------------------------------------------------------------%
\usetikzlibrary{arrows.meta, chains, fit, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 5mm and 7mm,
start chain = A going above,
base/.style = {rectangle, draw, rounded corners,
minimum width=24mm, minimum height=8mm},
inbox/.style = {base, fill=blue!20, on chain, join=by -Stealth},
outbox/.style = {base, fill=red!20},
]
\node [inbox] {3}; % node name = A-1
\node [inbox] {2};
\node [inbox] {1}; % A-3
\node (f) [base, fit=(A-1) (A-3)] {};
\node (test) [outbox, above=of f] {Test};
%
\draw[-Stealth] (f) to ["opis" '] (test);
\end{tikzpicture}
\end{document}
short explanation of mwe code:
for all nodes is defined base style, which contain common node shapes features. it is latter used for define specific nodes in picture
for inner nodes (1, 2 and 3) is for placing used chains library. it put nodes in chain with distance between them determined by node distance = .... since chain is named (A) nodes are automatically named as A-1, A-2 and A-3
chains also enable macro join which simplified drawing connection lines between nodes in chain. style of connection can be determined locally (as is done in above mwe) or you can define external and this style also use for other lines in picturefit which draw node's shape around specified nodes or coordinates. in your case this is obtained by fit=(A-1) (A-3) where (A-1) and (A-3) are names of the most outer nodes in the chainf and start node is used arrows to which is add label "opis" (description? :) ). for it is used quotes library an+d syntax ["..."] which works only if for drawing line is used to or edge and not at --.tikz please read "TikZ & PGF manual for version 3.0.1a. it is part of pgf installation in your computer. it is stored in "... \doc\generic\pgf\pgfmanual.pdf". manual is hige (over 1150 pages), but for start is sufucient to read tutorials and part III TikZ ist kein Zeichenprogrammpgfmanual.pdf, for example http://ctan.ijs.si/tex-archive/graphics/pgf/base/doc/pgfmanual.pdf. it is also part of any tikz installation.
– Zarko
Aug 06 '17 at 10:04
\documentclass[twocolumn]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fit,arrows.meta}
\tikzset{%
>={Latex[width=2mm,length=2mm]},
base/.style = {rectangle, rounded corners, thick,
minimum width=2em, minimum height=1em,
node distance=6em, text centered, font=\sffamily},
}
\tikzset{jeden/.style={draw, fill=gray!15,node distance=6em}}
\tikzset{dwa/.style={ draw, rounded corners}}
\begin{document}
This is a text.
\tikzstyle{ramka} = [rectangle, draw, inner sep=0.5cm, dashed]
\begin{center}
\vskip 1mm
\begin{tikzpicture}[scale=.9, transform shape]
\node [jeden] (zero) at (0, 0) {Test 0};
\node [dwa,right of=zero,name=one,node distance=9em] (one) {1};
\node [dwa,below of=one,node distance=4em] (two) {2};
\node [dwa,below of=two] (three) {3};
\node [dwa,below of=three,minimum width=7em] (four) {4};
\node [ramka, fit=(two) (four)] (container) {};
\draw [->] (one) -- (zero);
\draw [->] (container) -- node[text width=2cm,near end] {opis} (one);
\draw [->] (three) -- (two);
\draw [->] (four) -- (three);
\end{tikzpicture}
\end{center}
End off message. End of text.
\end{document}
I add some modifications to show different distance. but base style not good
\draw [->] (node A) -- (node B);– Torbjørn T. Aug 05 '17 at 15:30