# Hiding a part of a plot

Is there a way to hide a part of a plot, possibly by specifying the interval numerically?

I have a plot with xmin, xmax, ymin and ymax defined and I need to move it from the y axis without using enlarge x limits.

In this case, I would like to keep everything as it is and just hide the part of the plot between -0.5 and 0 on the x axis.

Minimal working example:

\documentclass[border=2pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-0.5,
xmax=5.5,
ymin=-1.54,
ymax=16.96,
]

\addplot[style=loosely dashed, thick] gnuplot{0.261*x+8.073};

\end{axis}
\end{tikzpicture}
\end{document}


The aim is to correctly align two axes, one of them with symbolic coordinates and automatic padding, hence unable to plot this function. Should someone think of covering it by using an overlaying shape, it is unacceptable because the background varies in colour.

-

You can set the range over which the function is evaluated using the domain=<min>:<max> key.

\documentclass[border=2pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-0.5,
xmax=5.5,
ymin=-1.54,
ymax=16.96,
domain=0:5.5
]

\addplot[style=loosely dashed, thick, samples=2] gnuplot{0.261*x+8.073};

\end{axis}
\end{tikzpicture}
\end{document}

-
I have specified the domain before and yet I did not think of it somehow. :-) Thank you very much! – Harold Cavendish Apr 17 '12 at 18:57