-
Notifications
You must be signed in to change notification settings - Fork 45
Description
As Jason described in an old post about this issue, in NetLogo desktop when you use set-plot-pen-color all existing points/lines already on the plot for your pen stay the color they were, and any new points you add will use the new color. In NetLogo Web, all points old and new are changed to the new color you set.
Sample code for a model with a single plot named test:
to plot-pen-color-change-fail
clear-all
set-current-plot "test"
create-temporary-plot-pen "ziggy pen"
set-plot-pen-color blue
plotxy 0 0
plotxy 1 5
set-plot-pen-color red
plotxy 2 7
plotxy 3 11
endThe result will be a red line instead of a half blue, half red line.
Quoting Jason:
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.
I wanted to open this issue just so the difference had it's own place to be tracked in case we ever decide it's worth putting time into. I have encountered at least one user model that relied on the ability to change the plot pen color in the middle of the data set. The workaround is also given by Jason:
A workaround for anyone who finds the old behavior absolutely essential to their use case: Create a new pen for each new color.
And that should work for most use cases, but if someone wants to use the plot legend with a single entry for the pen, creating more pens per color will not work for them.