Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeatedly plotting the same point causes weird extra lines #393

Open
LaCuneta opened this issue Feb 9, 2021 · 0 comments
Open

Repeatedly plotting the same point causes weird extra lines #393

LaCuneta opened this issue Feb 9, 2021 · 0 comments

Comments

@LaCuneta
Copy link
Contributor

LaCuneta commented Feb 9, 2021

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).

chart

A few notes on the behavior:

  • If you avoid repeating the plotxy 0 0 and only do it once, the extra lines do not appear.*
  • If you do not set-plot-pen-color on every tick the extra lines do not appear (!?).*
  • It doesn't matter which point you choose to repeat, if you do plotxy 2 2 instead of plotxy 0 0 you'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 go again.

*Either or both of these are probably the best workarounds for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant