matt-dray / pixeltrix

:space_invader::computer_mouse: R package: make pixel art interactively in a plot window, get a matrix, make a gif
Other
21 stars 0 forks source link

Dimension (`n_rows`, `n_cols`) of 1 results in error #9

Closed matt-dray closed 1 year ago

matt-dray commented 1 year ago

Dimension of 1 provided to click_pixels() results in error.

click_pixels(n_rows = 1L)
#  Error in seq.default(0 - y_unit - (y_unit/2), 1 + y_unit + (y_unit/2), : 
# 'from' must be a finite number
click_pixels(n_cols = 1L)
#  Error in seq.default(0 - x_unit - (x_unit/2), 1 + x_unit + (x_unit/2), : 
# 'from' must be a finite number

Because Inf.

Consider the impact of the reversing/transposing of the matrix for the `image(), given an x or y dimension of 1.

Force abline() to c(-1, 1) if dimension is 1.

matt-dray commented 1 year ago

Also, when grid is FALSE:

click_pixels(n_rows = 1, grid = FALSE)  # then click the plot
# Error in if (next_state > n - 1L) { : argument is of length zero
click_pixels(n_cols = 1, grid = FALSE)  # then click the plot
# Error in if (next_state > n - 1L) { : argument is of length zero