![从 tikz 中包含的图像的部分绘制线条?](https://linux22.com/image/359792/%E4%BB%8E%20tikz%20%E4%B8%AD%E5%8C%85%E5%90%AB%E7%9A%84%E5%9B%BE%E5%83%8F%E7%9A%84%E9%83%A8%E5%88%86%E7%BB%98%E5%88%B6%E7%BA%BF%E6%9D%A1%EF%BC%9F.png)
答案1
在以下帮助下使用 TikZ 在图像上绘图:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node [inner sep=0pt,above right] (img) at (0,0){\includegraphics[width=0.1\textwidth]{img/specto_snap}};
\begin{scope}[x=(img.south east),y=(img.north west)]
% draw dividing lines
\foreach \y in {1,...,5}
\draw [red,ultra thick,dashed] (0,\y/6) -- (1,\y/6);
% draw arrows from middle of each section
\begin{scope}[-stealth,thick]
\draw (0.5,1/12) -- ++(1,0) node[right] {foo};
\draw (0.5,3/12) -- ++(1,0) node[right] {bar};
\draw (0.5,5/12) -- ++(1,0) node[right] {baz};
\draw (0.5,7/12) -- ++(1,0) node[right] {foobar};
\draw (0.5,9/12) -- ++(1,0) node[right] {foobaz};
\draw (0.5,11/12) -- ++(1,0) node[right] {foobarbaz};
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}
答案2
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt] (Img) {\includegraphics[width=3cm,height=10cm]{example-image}};
%% Lines
\foreach \y in {1,...,5}{
\draw[very thick] ($(Img.south west)!\y/6!(Img.north west)$) -- ($(Img.south east)!\y/6!(Img.north east)$);
}
%% Arrows
\foreach \ylabel [count=\y] in {one,two,three,four,five,six}{
\draw[very thick,-latex] ($(Img.south)!\y/6-1/12!(Img.north)$) -- +(5,0) node[right]{\ylabel};
}
\end{tikzpicture}
\end{document}