Rolling Plot Example

Rolling Plot Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 433 times • Downloaded 78 times • Run 0 times
Download the 'Rolling Plot Example' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


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

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

to setup
  clear-all
  create-turtles 1
  [                               ; create one turtle
    set color red
    set xcor (2 + min-pxcor)      ; set the turtle's initial position and heading
    set ycor 0
    set heading 0
    set size 5                    ; easier to see this way
    pen-down
  ]
  reset-ticks
end 

to go
    ask turtles
    [
      fd (pi * (max-pycor - 2) / 180) / 8   ; move in a circle
      rt 0.125
    ]
    tick
end 

;; the actual plotting code is in the plot itself, in the Interface tab


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 12 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 13 years ago Updated version tag Download this version
Uri Wilensky over 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky about 15 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 15 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 15 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 15 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 15 years ago Model from NetLogo distribution Download this version
Uri Wilensky about 15 years ago Rolling Plot Example Download this version
Uri Wilensky about 15 years ago Rolling Plot Example Download this version

Attached files

File Type Description Last updated
Rolling Plot Example.png preview Preview for 'Rolling Plot Example' over 12 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.