Created
June 15, 2021 18:28
-
-
Save toebR/cec8f53a50820c7f22094cf40952f841 to your computer and use it in GitHub Desktop.
This file contains 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
#a snippet for quick plots of LIDAR data in ggplot2 | |
#Tobias Stalder | |
#June 2021 | |
#load libraries | |
library(tidyverse) | |
library(rlas) | |
library(gg3D) | |
#load data | |
dat <- rlas::read.las(files = r"(C:\PATH\TO\FILE\lidaR_dat.las)") | |
#subset dataset | |
n <- 10 | |
df_new <- dat[seq(1, nrow(dat), n), ] #only take every nth point | |
#check amount of points | |
nrow(df_new) | |
#angles | |
theta=0 | |
phi=40 | |
#plot | |
ggplot(df.new, aes(x=X, y=Y, z=Z, color=-Z), | |
size = .1, alpha = .5) + | |
axes_3D(theta=theta, phi=phi) + | |
stat_3D(theta=theta, phi=phi) + | |
scale_color_viridis_c() + theme_void() + | |
ggsave(filename = r"(C:\PATH\TO\FOLDER\lidar_scatter.png)", | |
width = 15, height = 15, limitsize = FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment