Galapagos
Galapagos copied to clipboard
Repeatedly plotting the same point causes weird extra lines
Suppose you have a model with a single plot called test and a button for setup and a forever button for go:
to setup
clear-all
set-current-plot "test"
create-temporary-plot-pen "ziggy pen"
set-current-plot-pen "ziggy pen"
reset-ticks
end
to go
set-plot-pen-color red + 2
ifelse ticks < 5 [
plotxy 0 0
] [
plotxy (ticks / 2) (ticks + random ticks)
]
tick
end
It should create a nice jagged line climbing up and to the right. It kind-of does but it also generates weird random lines back to point (0, 0).

A few notes on the behavior:
- If you avoid repeating the
plotxy 0 0and only do it once, the extra lines do not appear.* - If you do not
set-plot-pen-coloron every tick the extra lines do not appear (!?).* - It doesn't matter which point you choose to repeat, if you do
plotxy 2 2instead ofplotxy 0 0you'll get the same behavior. - If you export the model state with the extra lines and then import it back the plot will appear correct without the extra lines until you hit
goagain.
*Either or both of these are probably the best workarounds for this issue.