创建后剪辑/修剪/裁剪 tikz 图形

创建后剪辑/修剪/裁剪 tikz 图形

我有一张图片

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[trim=400 450 500 450, clip,width=0.9\textwidth]{../Bilder/Explanations/early-abandoning.png}};
%     [trim=left bottom right top, clip]
    \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
    \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
        \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
    \end{scope}
\end{tikzpicture}
\end{document}

我想裁剪。如果我进一步裁剪\includegraphics,线条将不再合适。因此,我想在放置所有线条等之后进一步裁剪图像。我该怎么做?

澄清:

这就是我所拥有的:

在此处输入图片描述

这就是我要的:

在此处输入图片描述

这是我仅更改装饰后得到的结果\includegraphics

在此处输入图片描述

答案1

评论太长了。我下载了你的图片,所以很可能图片被重新缩放了。这个片段截取了图片的一部分。

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\coordinate (sw) at (0,0);
\coordinate (ne) at (8,8);
\begin{scope}
    \clip  (sw) rectangle (ne); % clip some region
    \node[anchor=south west,inner sep=0] (image) at (-4,-4)  %<-move the image center
    {\includegraphics[scale=0.6]{early-abandoning.png}};
\end{scope} 
%     [trim=left bottom right top, clip]
    \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
    \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
    \begin{scope}[x={8cm},y={8cm}]
        \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
        \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
        \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
    \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

由 Make42 编辑:

这里是剪辑整个 tikzpicture 的解决方案:

\begin{tikzpicture}
    \coordinate (sw) at (0,0);
    \coordinate (ne) at (6,6);
    \begin{scope}
        \clip  (sw) rectangle (ne); % clip some region
        \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[trim=450 450 500 450, clip,width=0.9\textwidth]{../Bilder/Explanations/early-abandoning.png}};
    %     [trim=left bottom right top, clip]
        \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
        \draw (3,2) -- ++(70:3cm) -- ++(-50:1cm) -- ++(20:1cm) -- ++(0:1cm);
        \begin{scope}[x={(image.south east)},y={(image.north west)}]
            \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
            \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
            \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
        \end{scope}
    \end{scope} 
\end{tikzpicture}

在此处输入图片描述

相关内容