r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
582 stars 130 forks source link

No plot with plot function (same with plot_dtm3d) #716

Closed Redcozmo closed 11 months ago

Redcozmo commented 11 months ago

Hello,

I'm testing lidR package. I've an issue with plotting simple plots with plot function.

With this code :

LASfile <- system.file("extdata", "Topography.laz", package="lidR") las <- readLAS(LASfile, select = "xyzc") plot(las, size = 3, bg = "white")

Nothing is plotted.

But with backend='lidRviewer'

plot(las, backend='lidRviewer', size = 3, bg = "white")

The Point Cloud Viewer window appears (but without background require by my parameter)

I have the same issue with plot_dtm3d function

With this code :

dtm_tin <- rasterize_terrain(las, res = 1, algorithm = tin()) plot_dtm3d(dtm_tin, bg = "white")

Nothing is plotted. Neither with backend='lidRviewer'

Thanks for helping.

Jean-Romain commented 11 months ago

Does rgl work? Try plotting a basic rgl graph without involving lidR

Redcozmo commented 11 months ago

No it does not work like with this exemple :

library(rgl)
with(iris, plot3d(Sepal.Length, Sepal.Width, Petal.Length, type="s", col=as.numeric(Species)))

I've just found this issue : 180

And for me it works when I run rglwidget() after plot(las, size = 3, bg = "white")

And a when loading rgl library an explicite message is printed

library('rgl')
This build of rgl does not include OpenGL functions.  Use
 rglwidget() to display results, e.g. via options(rgl.printRglwidget = TRUE).

And in my first code I did not have loading rgl library.

Jean-Romain commented 11 months ago

So it is a problem with rgl not lidR. I guess you are working on Mac. Anyway I've already seen rgl working on Mac, so it can work, but I can't help.

Redcozmo commented 11 months ago

Yes not lidR ! Thanks. But I'm on Ubuntu