If you look at y you'll see it's just numbers, 1.0 etc. plot.plt(x,y) shows a continuous stairstep plot. Zoomed in enough you'll see that the verticals aren't exactly that; they show the change in y from 1.0 to 2.0, with in one small step in x.
Look at every 100th value of x.
In [13]: x[::100]
Out[13]:
array([-5.0000000e+00, -4.0000000e+00, -3.0000000e+00, -2.0000000e+00,
-1.0000000e+00, -1.0658141e-13, 1.0000000e+00, 2.0000000e+00,
3.0000000e+00, 4.0000000e+00])
Looking a ceil at those points, and following:
In [15]: np.ceil(x[::100])
Out[15]: array([-5., -4., -3., -2., -1., -0., 1., 2., 3., 4.])
In [16]: np.ceil(x[1::100])
Out[16]: array([-4., -3., -2., -1., -0., 1., 2., 3., 4., 5.])
We could change y at each of those jumps to np.nan.
In [17]: y[::100]=np.nan
Then the plt(x,y) will skip the nan values, and show just the flats without the near-vertical riser.

red dash in the connected y, blue is the disconnected with nan values.
The other answer does a separate plot for each level.
A comment suggested stair, but I haven't worked out the calling details.
In any case, getting disconnected plot requires special handling of the plotting. It isn't enough to just create the x,y arrays.
step().y, is just an array of numbrs. It isn't a function.pltjust draws a line between all thex,ypairs. It isn't, in a mathematical function sense, a contiguous, or discontinuous, function.