# Plot “timeout” with pgfplots

I'm plotting some timing results using pgfplots. The times are shown on a log scale.

Each of the three techniques eventually ends in a timeout, and I'd like to show that somehow in the graph.

I think it would be nice to show each of the three lines shooting off the top of the graph somehow. For instance, Technique A times out when number of threads is 4, so I'd quite like an additional green data-point at x=4, positioned a few millimetres above the current extent of the y-axis.

Alternative suggestions for how to depict "time out" are also welcome.

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[xlabel=Number of threads, ylabel=Simulation time /s, legend
pos=south east]
(1, 0.006)
(2, 0.061)
(3, 25)
};
(1, 0.006)
(2, 0.009)
(3, 0.053)
(4, 1.3)
(5, 70)
};
(1, 0.360)
(2, 0.370)
(3, 0.360)
(4, 0.462)
(5, 3.2)
(6, 120)
};
\legend{Technique A, Technique B, Technique C}
\end{semilogyaxis}
\end{tikzpicture}
\end{document}


# Vertical line

Time out could be interpreted as infinite value for the vertical time axis, visualized by a vertical line to make clear that the next thread is never reached.

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
ylabel=Simulation time in s,
legend pos=south east,
ymax=250,
]
(1, 0.006)
(2, 0.061)
(3, 25)
(3, 1000)
};
(1, 0.006)
(2, 0.009)
(3, 0.053)
(4, 1.3)
(5, 70)
(5, 1000)
};
(1, 0.360)
(2, 0.370)
(3, 0.360)
(4, 0.462)
(5, 3.2)
(6, 120)
(6, 1000)
};
\legend{Technique A, Technique B, Technique C}
\node[above right] at (rel axis cs:0, 1) {Time out:};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}


# Time out as data point outside

Basically this variant is similar to Torbjørn T.'s answer, which draws a connected line to the outside of the plot area.

However, I do not like the connecting line, because their slopes are smaller, destroying the curve forms.

Therefore, the example does not connect the time out points and labels the points with "Time out".

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
ylabel=Simulation time in s,
legend pos=south east,
xmax=7.5,
ymax=200,
clip=false,
]
(1, 0.006)
(2, 0.061)
(3, 25)
};
(1, 0.006)
(2, 0.009)
(3, 0.053)
(4, 1.3)
(5, 70)
};
(1, 0.360)
(2, 0.370)
(3, 0.360)
(4, 0.462)
(5, 3.2)
(6, 120)
};
\legend{Technique A, Technique B, Technique C}
\node[above right] at (rel axis cs:0, 1) {Time out:};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}


• the vertical line is a pretty good simple solution. when we visualize this, we typically show the curve leaving the chart in an asymptotic fashion, instead of showing the actual vertical. just another variation. – aeroNotAuto Jun 25 '15 at 2:48

I'm not sure if this is anything like what you had in mind, but if you add another data point, set the ymax to a smaller value than the y-value for this new data point, and finally add clip=false, you get plot lines extending out of the axis.

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
ylabel=Simulation time /s,
legend pos=south east,
ymax=200,
clip=false]
(1, 0.006)
(2, 0.061)
(3, 25)
(4,300)
};
(1, 0.006)
(2, 0.009)
(3, 0.053)
(4, 1.3)
(5, 70)
(5.5,300)
};
(1, 0.360)
(2, 0.370)
(3, 0.360)
(4, 0.462)
(5, 3.2)
(6, 120)
(6.3,300)
};
\legend{Technique A, Technique B, Technique C}
\end{semilogyaxis}
\end{tikzpicture}

\end{document}