how to hide data that is not within the range that is supposed to be displayed

I have a 2D plot where I only want to display one portion of the domain
at a time (for example, 2000 points of data but I only want to show 500
points at a time), but when I call setRange on the scalarMap the plot
continues off the graph.

What do I have to do to to hide this data?