Created
October 13, 2021 16:56
-
-
Save ptompalski/1aea3e7764b73703a24437adc3c1ed0e to your computer and use it in GitHub Desktop.
plot a crossection of a point cloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function to plot a crossection of a point cloud | |
# works with lidR package | |
plot_crossection <- function(las, | |
p1 = c(min(las@data$X), mean(las@data$Y)), | |
p2 = c(max(las@data$X), mean(las@data$Y)), | |
width = 4, colour_by = NULL) | |
{ | |
colour_by <- enquo(colour_by) | |
data_clip <- clip_transect(las, p1, p2, width) | |
p <- ggplot(data_clip@data, aes(X,Z)) + geom_point(size = 0.5) + coord_equal() + theme_minimal() | |
if (!is.null(colour_by)) | |
p <- p + aes(color = !!colour_by) + labs(color = "") | |
return(p) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment