0

I have got many plots of spectral data with the persp3dfunction and with open3d I am able to open them in different windows (see below). My question is if there is a possibility to open them up in the same window, by giving a number of rows and columns? And if so, is there furthermore the possibility that the rotation I do with the mouse applies to all the displayed plots?

Below I have already found a way to open them up in different windows without overlapping so I can examine them separately (in the code: "t_number" and "w" are vectors corresponding to the "Fnumber" matrix respectively).

I tried doing it with the plot3d and the mfrow3d command, resulting in one window with many plots (like the answer posted to this question, but the plot3d function is not capable of giving sufficient data plots (the spectral data does not look alike the same data as in persp3d).

   open3d(
    persp3d(t_134, w, F134, col = col,
               xlab = "", ylab = "", zlab = "", main = "F134", 
      )
    )
    open3d(
     persp3d(t_135, w, F135, col = col,
               xlab = "", ylab = "", zlab = "", main = "F135"
      )
    )
    [...]

How can I plot them in one window and rotate them all the same?

Capt.Krusty
  • 597
  • 1
  • 7
  • 26

1 Answers1

1

Your use of open3d( ... plot function ...) is wrong. The arguments to open3d control characteristics of the window. You shouldn't be passing rgl plotting results to it.

To open multiple plots in a single window, after calling open3d properly, call mfrow3d(rows, cols, sharedMouse = TRUE) to set up an array of plots. They will all respond to mouse actions in any of them.

For example:

library(rgl)
x <- rnorm(100)
y <- rnorm(100)
z <- rnorm(100)
open3d()
mfrow3d(2, 2, sharedMouse = TRUE)
plot3d(x, y, z, col = "red")
plot3d(x, y, z, col = "green")
plot3d(x, y, z, col = "blue")
plot3d(x, y, z, col = "yellow")

screenshot

There are other functions if you don't want an array of equal-sized plots: layout3d, etc.

user2554330
  • 37,248
  • 4
  • 43
  • 90