Scale-scheme misses a color
Closed this issue · 1 comments
IsaacNoel commented
The palette:scale-scheme primitive incorrectly scales its value to a color. This bug is present in the library model Palette Example.
In the model, this code:
to normal-scale-scheme
ask patches [
set plabel round patch-value
set pcolor palette:scale-scheme "Sequential" "Reds" 9 patch-value 0 10
]
end
where patch-value is calculated as:
to-report patch-value
let normalized-value (pxcor + (pycor * world-width)) / (world-width * world-height)
report normalized-value * 10 + 5
end
There should be 9 colors in the view because palette:scale-scheme
will report one of 9 colors from "Sequential" "Reds" 9, depending on how 'patch-value' scales from 0 to 10. However, the view only shows 8 colors.
Here's another example of the bug. The command:
ask patches [set pcolor palette:scale-scheme "Divergent" "BrBG" 3 pxcor min-pxcor max-pxcor]
which should have 3 evenly spaced colors.
There must be something wrong with how the number is scaled to a color.