You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 00
plotxy 15
set-plot-pen-color red
plotxy 27
plotxy 311
end
The 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.
The text was updated successfully, but these errors were encountered:
I just stumbled on a side-effect of this - because set-plot-pen-color recolors all points, if you've used plot-pen-up to skip drawing some points, then once you change the pen color those previously invisible lines will become visible. This can be seen with the Decay model from the library. A workaround is, as above, use a different pen for each color to avoid changing the pen color at all.
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:
The result will be a red line instead of a half blue, half red line.
Quoting Jason:
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:
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.
The text was updated successfully, but these errors were encountered: