Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plot3d - having two plots at once

Tags:

plot

r

rgl

plot3d() produces a 3d plot that I can twist around and rotate. But when I call plot3d() again, the previous plot goes away and is replaced by this one.

How can I make it so that a new XQuartz window opens up rather than the old window being replaced by the new 3d plot.

Essentially, I want two 3d plots opened at once.

like image 467
CodeGuy Avatar asked Feb 05 '13 16:02

CodeGuy


People also ask

Can we have multiple 3D plot in Matlab?

Can we have multiple 3d plots in MATLAB? Explanation: The plot3() function is a pre-defined function in MATLAB. So, it will allow the use to generate multiple 3d plots. This is inherent to the system.

How to plot multiple plots in Matplotlib?

Multiple Plots using subplot () Function. A subplot () function is a wrapper function which allows the programmer to plot more than one graph in a single figure by just calling it once. Syntax: matplotlib.pyplot.subplots (nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)

What is going on when I use PLOT3D[F1/F2}?

But if use Plot3D [ {f1,f2}...] then the graph is messed up. What is going on ? I am guessing that Plot3D [] with multiple functions tries to decide on a compromise mesh that will work for all arguments. But in the following example where both functions basically have the same values, I don’t understand how it can fail.

How to plot multiple graphs on the same plot in R?

One is by using subplot () function and other by superimposition of second graph on the first i.e, all graphs will appear on the same plot. We will look into both the ways one by one.

How to plot more than one graph in a single figure?

We will look into both the ways one by one. A subplot () function is a wrapper function which allows the programmer to plot more than one graph in a single figure by just calling it once. Syntax: matplotlib.pyplot.subplots (nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)


1 Answers

like this:

 library(rgl)

 open3d()
 x <- sort(rnorm(1000))
 y <- rnorm(1000)
 z <- rnorm(1000) + atan2(x,y)
 plot3d(x, y, z, col=rainbow(1000))

 open3d()
 x <- sort(rnorm(20))
 y <- rnorm(20)
 z <- rnorm(20) + atan2(x,y)
 plot3d(x, y, z, col=rainbow(20))

The key here is calling open3d before the second plot to open a new "device"

like image 167
user1317221_G Avatar answered Oct 24 '22 22:10

user1317221_G