I want to plot tan(x) vs x with a gap in the line plot when x goes thought pi/2, the point where tan(x) goes from +infinity to -infinity. The idea is to insert nan between the points in the tan(x) and x arrays at x=pi/2, which will leave the desired gap when plot is called. Does anyone have an efficient way to do this?