# [Tex/LaTex] Clipping Elements in Tikz

tikz-pgf

I am trying to draw a picture using TikZ in LaTeX. In this example, I have drawn two curved lines and a vertical line. I would like to make the lower curved line only visible to the right of the vertical line. In other words, I would like to clip the lower curved line. However, I do not want to clip the entire picture. I would still like to view the entire top curve. Is this possible in TikZ?

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=5]
\draw (.1,1.6) .. controls (.6,1.6) and (1.5,1) .. (2,1);
\draw (.1,1) .. controls (.6,1) and (1.5,.4) .. (2,.4);
\draw[dashed] (1,0) -- (1,2);
\end{tikzpicture}

\end{document}


Yes, you can use the \clipcommand inside a scope:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=5]

\begin{scope}
\clip(1,0) rectangle (2,2);
\draw (.1,1.6) .. controls (.6,1.6) and (1.5,1) .. (2,1);
\end{scope}

\draw[dashed] (1,0) -- (1,2);

\end{tikzpicture}

\end{document}


Only the things in the scope are clipped:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=5]
\draw (.1,1.6) .. controls (.6,1.6) and (1.5,1) .. (2,1);

\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (.1,1) .. controls (.6,1) and (1.5,.4) .. (2,.4);
\end{scope}

\draw[dashed] (1,0) -- (1,2);
\end{tikzpicture}

\end{document}