Farsi / Persian
NetLogo Models Library:
This shows how to make a "rolling" plot, in which only the last n time steps of data are displayed.
In the plot, the
set-plot-x-range command is used to set the visible range to only the most recent 800 ticks.
Note that we change the range after plotting, not before. That's because if autoplot is on, plotting a point could change the range, after which we need to change it again. (It is not possible to turn autoplot on for only one axis, so if we want it for the y-axis, we must live with having it on the x-axis too.)
Also note that setting the x range doesn't cause old data to be discarded. Even if the old data isn't visible on the screen, it can be revealed by changing the x range to something wider, or by exporting the plot.