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

Temporary plot pens ignore pen color #146

Closed
ToonTalk opened this issue Jun 2, 2015 · 1 comment
Closed

Temporary plot pens ignore pen color #146

ToonTalk opened this issue Jun 2, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@ToonTalk
Copy link

ToonTalk commented Jun 2, 2015

This model works fine in the desktop version but the line is black in Tortoise (using http://li425-91.members.linode.com:9000/create-standalone):

https://dl.dropboxusercontent.com/u/51973316/temp-pen-color-bug.nlogo

to startup
  set-current-plot "plot 1" 
  create-temporary-plot-pen "red pen"
  set-plot-pen-color red 
  set-plot-pen-mode 0
  plotXY 0 0
  plotXY 5 5
end
@TheBizzle TheBizzle self-assigned this Jun 2, 2015
@TheBizzle TheBizzle added the bug label Jun 2, 2015
@TheBizzle TheBizzle added this to the 1.0 milestone Jun 2, 2015
@TheBizzle
Copy link
Member

Thank you for another helpful report. This will show up fixed when the server is updated next. However, there's some nuance to this fix, and I'd like to document that here.

Before this fix, set-plot-pen-color did not really do anything at all in NetLogo Web (even though it theoretically should have—my mistake). When I initially implemented plotting, I tried to accommodate for NetLogo's quirky ability to have a multicolored plot pen trail, but telling the plotting library to handle that (incredibly atypical) case made plotting performance absolutely awful, and it only updated the plot marker dots, not the lines. I couldn't really find any good plotting library that supported lines that would partially changed colors, so it seems to me that that (anti-)feature will just go unsupported in NetLogo Web.

However, that doesn't mean that set-plot-pen-color should do nothing in NetLogo Web. I gave up the "multicolor" feature, but I simply forgot about handling the case reported here, which covers a very sensible and legitimate thing to want to do with a plot pen. In this case, you're not trying to have a multi-colored pen trail; you just want to programatically create a pen and set its color. This is absolutely essential for coloring temporary plot pens (unless we someday change create-temporary-plot-pen to take a color as an argument), and there are other reasons I can imagine for wanting to dynamically set/change the color of your entire plot pen's trail, as well, so the primitive needs to be at least partially supported.

But, anyway, the reason that I write this is not to conduct Software Engineering Story Time. Rather, my goal here is to document a deviation of NetLogo Web from what JVM NetLogo does. In JVM NetLogo, you can have a plot pen start to draw with color1, and then call set-plot-pen-color color2 and have it draw new plot points/trails with color2. This behavior will not be supported in NetLogo Web. Instead, the color provided in the most-recent call of set-plot-pen-color for that pen will be the color used for all of that pen's drawings—past and future.

A workaround for anyone who finds the old behavior absolutely essential to their use case: Create a new pen for each new color.

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

No branches or pull requests

2 participants