Closed s-kganz closed 1 year ago
Hello,
The documentation for lidR::plot says that the breaks argument can be
lidR::plot
breaks
either a numeric vector with the actual breaks, or a name of a method accepted by the style argument of classIntervals
classIntervals
But when I try to supply my own breaks, an error is returned. To reproduce:
library(lidR) LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR") las <- readLAS(LASfile) plot(las, axis=TRUE, legend=TRUE, breaks=seq(0, 40, by=2)) #> Error in classInt::classIntervals(colorattr, min(nbreaks, nunique), breaks) : #> 0 unknown
Looking at the relevant function in classInt, it seems that one can specify the style as "fixed" and then pass the breaks as a separate argument:
classInt
"fixed"
mybreaks <- seq(0, 40, by=2) classInt::classIntervals(las$Z, length(mybreaks), style="fixed", fixedBreaks=mybreaks) #> style: fixed #> [0,2) [2,4) [4,6) [6,8) [8,10) [10,12) [12,14) [14,16) [16,18) [18,20) [20,22) [22,24) #> 9446 633 769 1087 1570 2164 3025 4052 4104 3847 3482 2098 #> [24,26) [26,28) [28,30) [30,32) [32,34) [34,36) [36,38) [38,40] #> 1004 265 70 39 2 0 0 0
Unless I'm missing something, this should be fixable with a small change in plot.
plot
Fixed, thank you for reporting
Hello,
The documentation for
lidR::plot
says that thebreaks
argument can beBut when I try to supply my own breaks, an error is returned. To reproduce:
Looking at the relevant function in
classInt
, it seems that one can specify the style as"fixed"
and then pass the breaks as a separate argument:Unless I'm missing something, this should be fixable with a small change in
plot
.