# Plot x=3 in PGFPlots

I just started to use pgfplots and I'm trying to plot the line x=3 (a line parallel to the y axis where x is 3). I've tried to find an answer on the net, but all the examples always show how to ploy cases of y=..., and not the other way around.

I should point out that the graph contains more than one plot (if it matters).

-

One way to do this is to use \addplot coordinates. Or, as Jake suggested one could let the second coordinate be the variable (3,x)

## Code:

\documentclass{article}
\usepackage[paperwidth=21.0cm]{geometry}% for image capture
\usepackage{pgfplots}

\begin{document}\noindent
\begin{tikzpicture}
\begin{axis}[xlabel=$x$, ylabel=$y$]
\addplot[color=red,mark=none, ultra thick]  coordinates {(3,-3) (3,3) };
\end{axis}
\end{tikzpicture}
%
\begin{tikzpicture}
\begin{axis}[ xlabel=$x$, ylabel=$y$]
\end{axis}
\end{tikzpicture}
\end{document}

-

You could also simply draw anything in TikZ into your axis.

\begin{tikzpicture}
\begin{axis}[xlabel=$x$, ylabel=$y$]

Even simpler would be \draw [blue] (axis cs:3,\pgfkeysvalueof{/pgfplots/ymin})--(axis cs:3,\pgfkeysvalueof{/pgfplots/ymax}); – Qrrbrbirlbel Jan 14 '13 at 14:50