This occurs if you use a matrix in draw_pixels() without a colours attribute:
> matrix(1:9,3) |> draw_pixels()
# Error in get_greys(n_states) : object 'n_states' not found
I think n_states is derived from the colours attribute, but there isn't any derivation of n_states if the attribute is not there. So just need to infer n_states from the values in the input matrix.
This is already handled in edit_pixels(), so might need to copy from there.
This occurs if you use a matrix in
draw_pixels()
without acolours
attribute:I think
n_states
is derived from thecolours
attribute, but there isn't any derivation ofn_states
if the attribute is not there. So just need to infern_states
from the values in the input matrix.This is already handled in
edit_pixels()
, so might need to copy from there.