# pgfplots: discontinuities

Although pgfplots supports discontinuities, the method described in the manual is only applicable for the zero crossing and is unable to handle data on both sides of the singularity. As I needed this functionality, I came up with this small hack. The code is rather ugly, the result is not. After all, we’re using LaTeX 😉

What does it look like?

The main idea is to restrict the input file with the appropriate restrict x to domain twice while shifting the right part of the diagram by a constant offset. The drawback: you have to define the labels by yourself, so please refrain from brain-dead copying.

Now here is the code – it is not minimal, but you will get the idea:

\documentclass[a4paper,10pt]{standalone}
\usepackage[utf8x]{inputenc}
\usepackage{tikz,pgfplots,color,amsmath,amssymb}

\usetikzlibrary{pgfplots.groupplots}

\usetikzlibrary{spy,backgrounds}
\definecolor{fu-blue}{RGB}{0, 51, 102} % blue text
\definecolor{fu-green}{RGB}{153, 204, 0} % green text
\begin{document}
\begin{tikzpicture}
\begin{axis}[legend columns=-1,legend style={anchor=north,at={(0.5,-.1)},draw=black!40},
xmin=450,xmax=800,ymin=-.15,ymax=.15,xlabel={electron energy [eV]},ylabel={dN/dE [a.u.]}, ylabel style={at={(1.2,0.5)}, anchor=north},xlabel style={at={(0.5,1.1)},anchor=south},grid=both,
xticklabels={,450,500,550,600,,1400,1450,1500},
extra x ticks={650},extra x tick style={grid=major, tick label style={xshift=0cm,yshift=.30cm}},extra x tick labels={\color{red}{/\!\!/}}
]