NetLogo banner

Home
Download
Help
Forum
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Rolling Plot Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This shows how to make a "rolling" plot, in which only the last n time steps of data are displayed.

HOW IT WORKS

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.

RELATED MODELS

Plotting Example

(back to the NetLogo Models Library)