I would like to fix the following plot:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{pgfmath}
\begin{document}
\begin{tikzpicture}[
reader/.style = {rectangle, draw, fill=#1, minimum width=4mm, minimum height=14mm}
]
% \draw[help lines, gray!30] (-12,-7) grid (7,7);
\pgfmathsetseed{13} % Set the seed for reproducibility
%
\def\radius{2.6}
\def\angleIncrement{360/5.6}
%
\coordinate (center) at (0,0);
\coordinate (R) at (-8.5,0);
%
\node[reader=blue!30] (R1) at (R) {};
\node[above] at (R1.north) {{Reader}};
\draw[fill=none] (0,0) circle (\radius);
\foreach \i/\label in {1/A, 2/B, 3/C, 4/D, 5/E} {
\pgfmathsetmacro{\angle}{\angleIncrement * (\i + 1)}
\coordinate (\label) at ($(center) + (\angle:\radius)$);
\node[ rectangle,draw=black, fill=green!30, minimum width=2pt, minimum height=20pt,
rotate={5 + 10*rand}, scale=0.75] at (\label) {\label};
}
\draw[-, , draw=red, line width=0.5mm] (B.north) -- (A.south);
\draw[-, , draw=red, line width=0.5mm] (A.east) -- (E.west);
\draw[latex-latex, , draw=blue, line width=0.5mm] (E.west) -- (D.east) node[pos=0.7, above left, ] {\large{$d_{DE}$}};
\draw[-, , draw=red, line width=0.5mm] (D.east) -- (C.west);
\draw[-latex, dashed, line width=0.2mm] (R1.east) -- (B.west) node[pos=0.6, above, ] {\large{$d_{2}$}};
\draw[-latex, dashed, line width=0.2mm] (R1.east) -- (C.west) node[midway, above, ] (D3) {};
\draw[-latex, dashed, line width=0.2mm] (R1.east) -- (A.west) node[pos=0.7, above, ] (D1) {\large{$d_{1}$}};
\draw[-latex, dashed, line width=0.2mm] (R1.east) -- (E.west) node[midway, above, ] (D4) {\large{$d_{4}$}};
\path[] (D1) -- (D3) node[pos=0.85, scale=1.3] {$\vdots$};
\end{tikzpicture}
\end{document}
For example, dashed arrows d1, d2, d4 I would like to end at west
of nodes A, B, and E.
Also, connecting lines A-B, A-E, C-D, and double arrow D-E.
All lines uses the center of the node to start/end. For example, B-A should go from B.north
to A.south
.
Best Answer
There's no need to define a
coordinate
;it's simpler to define
node
, as the arrows between nodes go from edge to edge and not to the center.By the way, Tikz coordinates are zero-dimensional nodes.
So to draw arrows between nodes, there's no need to specify whether they start from north, south, east or another anchor.
simply write :
Complete code