嘗試使用 foreach 載入圖像

嘗試使用 foreach 載入圖像

我正在嘗試從目錄加載圖像,但我不能,因為我不知道為什麼\i不指示數字,程式碼搜尋目錄但找不到文件。

\documentclass{beamer}
\usepackage{pgfplots}
\usepackage{animate}
     \begin{document}
   \begin{frame}[label=detour]
    \animate<1-3>
    \begin{tikzpicture}
    \begin{axis}[name=plot1,
    clip=false,
    axis lines=center,
    height=4cm,
    width=4cm,
    x post scale=1.4,
    ]
    \foreach \i in {1,...,3}{
    \only<\i>{\addplot[blue, line width=0pt, fill=blue!20, opacity=0.5]   table [col sep=tab,trim cells=true, x index=0, y index=\i] {images_thesis/resolution_images/espectros_im_P_10_F_0_sigma_500.txt}\closedcycle}; 
 \only<\i>{\node[anchor=south west,inner sep=0] at (axis cs:20000,0) {\includegraphics[width=\textwidth]{./images_thesis/resolution_images/img-\i}};}}
   \end{axis}
   \end{tikzpicture}
   \end{frame}

   \end{document}

pdflatex編譯時的錯誤是

File `./images_thesis/resolution_images/img-\i ' not found. \end{frame}

相關內容