\documentclass[a4paper]{article}

\usepackage{pgfplots}

\usepgfplotslibrary{decorations.softclip}

\begin{document}

\setlength\fboxsep{0sp}
\fbox{%
\begin{tikzpicture}
	\draw[
		postaction={decorate,draw,ultra thick},
		decoration={soft clip,soft clip path={
			(1.5,-1) rectangle (4,2)
			},
		},
	]
	(0,0) -- (1,1) -- (2,1) -- (3,0)
	;
\end{tikzpicture}%
}

\fbox{%
\begin{tikzpicture}
	\draw[
		decorate,draw,ultra thick,
		decoration={soft clip,
			soft clip path={ (1.5,-1) rectangle (4,2) },
		},
	]
	(0,0) -- (1,1) -- (2,1) -- (3,0)
	;
\end{tikzpicture}%
}

\fbox{%
\begin{tikzpicture}
	\draw[
		decorate,draw,ultra thick,
		decoration={soft clip,soft clip path={
			(0.5,-1) rectangle (2,2)
			},
		},
	]
	(0,0) -- (1,1) -- (2,1) -- (3,0)
	;
\end{tikzpicture}%
}
\end{document}

