3D RGL Plot not showing in R - r

I am plotting a 3 dimensional PCA plot with R package "pca3d". However, the plot is not popping up as it usually does with conventional 2d plots (e. g. plotted with ggplot, ggbiplot or also with the 2d function of pca3d, i. e. pca2d).
> library(pca3d)
> pca3d(prncomp.pca)
[1] 0.4933764 0.3238404 0.3194022
The above is all I get. I guess pca3d relies on RGL. I saw this other thread Why is my 3D plot not showing up in R Studio plot viewer? bu was not able to solve my problem yet. Any suggestions?
EDIT: I am working on ubuntu 18.04

Related

Plotly by Akevelon boxplot does not give the same result as boxplot in r

I think I have found a possible bug in Plotly by Akevelon of Power bi. The thing is that I have made a boxplot in power bi using the component I mentioned above and I get very different metrics than if I do it with rstudio using the plotly package.
The boxplot I tried to make contains on the x=type and y=publication axis of the following dataset: https://www.kaggle.com/datasets/aneesayoub/world-universities-ranking-2022?resource=download
This are the results I get by using plotly on power bi
This are the results I get by using plotly on Rstudio
The code I used in R is the following:
library(ggplot2)
library(plotly)
pl=ggplot(my_data,aes(x=type,y=publication))+geom_boxplot(outlier.shape = NA)
ggplotly(pl)
Any idea of what is the problem?
I tried by using Python and I get the same results as R boxplot

Displaying multiple 3d plots in the same window using plot3D {rasterVis} in R

I am interested in making two 3d topographic plots that display side by side in the same Xquartz device window. Displaying two 3d plots in the same window is straightforward using the rgl package - there are plenty of examples in the documentation using mfrow3d() and other methods.
However, I need to use the plot3D() function from the rasterVis package. The reason I am using plot3D() from rasterVis, rather than something like surface3d() from rgl, is that I need to use the drape argument in plot3D() to display values from a raster as colors on a 3d topographic map (and this raster has different values than the one that creates the z axis on the plot). If anyone has tips on something analogous to drape within an rgl function, I would also be interested in that!
When I try to use mfrow3d() along with the plot3D() function, it brings up a series of blank device windows instead of displaying the two plots side by side in the same window.
Here is some code to make a topographic map using plot3D, from the rasterVis documentation:
data(volcano)
r <- raster(volcano)
extent(r) <- c(0, 610, 0, 870)
levelplot(r, col.regions=terrain.colors)
plot3D(r)
And here is where I try to use mfrow3d to plot 2 identical volcano plots side by side, one in blue and one in red, which I adapted from the rgl documentation:
volcanos <- list(r, r)
col <- c("blue", "red")
open3d()
mfrow3d(1,2)
for (i in 1:2) {
next3d()
plot3D(volcanos[[i]], col=col[i])
}
Is what I am trying to do even possible with plot3D from rasterVis?
The current version of rasterVis::plot3D opens a new device with each call. I have modified its code to test if there is an active device, and open a new one only if needed. With this commit your example works as expected. You should install the development version of rasterVis with devtools::install_github('oscarperpinan/rasterVis').

3d Vector plotting and visualization in R

Anyone know of any packages in R that can plot 3D vectors? I would like to plot some vectors over a 3 dimensional data set. I know scatterplot3d looks like it should be able to do the job, but I didn't see any documentation for vectors specifically (I would like to be able to change the origin of vectors as well).
rgl is a great package for 3d plotting. It is very like 2d plotting except that you use plot3d instead of plot. This answer on SO suggests a way to draw arrows in rgl.

R: levelplot vs. contourplot

I want to plot a contour of my data in R.
What is the difference between levelplot vs. contoutplot in package lattice and latticeExtra in R?
The 'latticeExtra' package contains none of the functions you mention.
Briefly, 'levelplot' fills in colored squares, while 'contourplot' makes curved lines like a topographic map.
But the best way for you to see is to simply look at and run the code for the examples for the two functions in the lattice package.

How to make 3D parallel coordinates plot in r

I´m looking for a R package to plot 3d parallel coordinates plot.
It looks like so:
Do you known any package?
There are quite a few. Via google searches "3d parallel coordinates plot in r" and "parcoord r"
1
2

Resources