Displaying 20 results from an estimated 3000 matches similar to: "3d plotting from a 2d array"
2012 Jul 05
1
Adding Text to a persp plot using specific coordinates
Hi folks,
I'm experiencing some hassle to add some text on a persp plot...
Here is the code to generate the persp plot:
x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 30)
z <- outer(x, y, function(a,b) a*b^2)
persp(x, y, z,xlim=c(-2,2),ylim=c(-2,2),zlim=c(-8,8), phi=30, theta=-30,nticks=8,ticktype="detailed")
I've tried the text() function :
2011 Mar 29
1
Dirichlet surface
Dear list members,
I want to draw surfaces of Dirichlet distributions with different
parameter settings.
My code is the following:
#<begin code>
a1 <- a2 <- a3 <- 2
#a2 <- .5
#a3 <- .5
x1 <- x2 <- seq(0.01, .99, by=.01)
f <- function(x1, x2){
term1 <- gamma(a1+a2+a3)/(gamma(a1)*gamma(a2)*gamma(a3))
term2 <- x1^(a1-1)*x2^(a2-1)*(1-x1-x2)^(a3-1)
2008 Jun 24
2
persp plot
I have a set of data in the form
x1, y1, z1
x1, y2, z2
...
x1, yN, zN
x2, y1, z(N+1)
x2, y2, z(N+2)
...
x2, yN, z(2N)
...and so on...
xM, yN, val(M*N)
I have been trying to figure out how to get R to use this data in a
persp plot. So far the only thing that I can figure out to do is to
break the data file into three different files. The first file
contains the x-coordinate data:
x1
x2
2009 Mar 29
2
number of ticks in a persp() plot
Hi, I am trying to specify four ticks (at 0,1,2,3 for the y axis) in a persp
plot but the defaults overrule my specification and I obtain seven of them.
Is it possible to gain full control over them in such a plot? Here is my
code:
matlines=matrix(c(1:7,3:9,3:9,2:8),nrow=7,ncol=4)
2011 Sep 08
1
3D plot RGL
Hi, anyone has experience with 3D plot (ex: in package RGL) I have a
question, I draw a 3D plot of country, year and sales in z axis but when the
type is "h" then it's ok but when I want to link the points and type is 'l'
lines it's a mess Is there a way to link the points only in one direction?
For example a unique line from each country through each year?
The code
2011 Jun 08
1
3D-plotting a 2D-matrix that contains z-values (3rd dimension)
Hello,
say I have a 2D-matrix (indexed by x and y), which contains
z values, which I want to plot over x-y.
Either dotted, or if possible as a landscape.
I tried around with persp and plot3d (from rgl)
and persp3d (from rgl).
I sometimes get something that looks good and a while later, when
trying some new data I need to worry about that again.
Is there something lika a convenience function
2007 May 29
1
rgl.postscript
Hi,
I am having an issue when creating a postscript file from RGL window. It
seems to cut off some of the axis labels. Here is the code I am using.
I created a 3D plot using RGL_0.71 with R 2.5 on Windows XP.
z1<-c(5,4,1,4.5,2,3,2,1,1)
z2<-c(6,8,7,7.5,5,3.5,4,1,1)
z3<-c(3,2,4,7,3,4.5,6,2,3)
x1<-seq(1,9)
x2<-seq(1,9)
x3<-seq(10,18)
y1<-seq(8,0)
y2<--1*y1
2005 Mar 16
1
Help in persp (VERY URGENT ASSISTANCE)
Dear All,
I am very new to R projects.May be i am wrong in some steps.I have given the code which i tried for drawing 3d surface using persp.I need to label the axes with scales
z <- array(topnew2$V2, dim=c(600,2))
x <- 10 * (1:nrow(z))
y <- (1:ncol(z))
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue", xlab ="fluidlevel", ylab
2012 Jul 10
1
RGL 3D curvilinear shapes
Dear useRs,
I'm trying to simply fill in the area under a curve using RGL. Here' the set
up:
x <- c(0.75,75.75,150.75,225.75,300.75,375.75,450.75,525.75,600.75,675.75,
0.5,50.5,100.5,150.5,200.5,250.5,300.5,350.5,400.5,450.5,
0.25,25.25,50.25,75.25,100.25,125.25,150.25,175.25,200.25,225.25)
y <- c(0.05,4.91,9.78,14.64,19.51,24.38,29.24,34.11,38.97,43.84,
2013 Feb 14
2
3D-plots of 2D-grids
Hello everybody,
I have an Ascii-grid (100x100m) with population density over Switzerland
(local coordinations system, CH LV03). Now I would like to have a nice
graphic to present the data. I would like to make a plot that will show the
density as the z-variable and raise for example a stacking pillar showing
how high the density is in that hectare. I attached a map that's similar to
what I
2010 May 26
1
persp(); help with 'tck' option
Hi All,
I'm using 'tck' option to *reduce* the length of tick marks but it is not
working, can anyone please tell me where I'm going wrong...
require(graphics)
require(grDevices)
x <- seq(-10, 10, length= 30)
y <- x
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
# 'bg' works but 'tck' is not showing
2006 Mar 28
1
Squished faxes with txfax
Hello,
I have been getting squished faxes very reliably when sending through Asterisk
using txfax. It looks as if all horizontal white space has been removed.
Interestingly it is perfectly repeatable, which seems to rule out timing
related issues.
My configuration is:
Asterisk SVN-branch-1.2-r7337M
spandsp-0.0.2pre21 ( though I have tried a 0.0.3 snapshot as well as
0.0.2pre25 )
libtiff
2013 Oct 15
1
plotting a marginal distribution on the plane behind a persp() plot
R'istas:
I am trying to plot a marginal distribution on the plane behind a persp() plot. My existing code is:
library(MASS)
X <- mvrnorm(1000,mu=c(0,0),Sigma=matrix(c(1,0,0,1),2))
X.kde <- kde2d(X[,1],X[,2],n=25) # X.kde is list: $x 1*n, $y 1*n, $z n*n
persp(X.kde,phi=30,theta=60,xlab="x_b",ylab="x_a",zlab="f") ->res
Any suggestions are very
2017 Oct 19
1
overlaying points and lines on a surface3d rgl plot with axes
Hi R users and experts,
I am interested in learning more about the use of 3D plots. Specifically, I
want to add points and lines to a surface plot. And get the axes and labels
plotted also. Here is what I have tried with an example data set :
library(rgl)
vol2 <- 2*volcano # Exaggerate the relief
library(reshape)
mvol2 <- melt(vol2)
str(mvol2)
# First, persp and persp3d plots do not succeed
2011 Dec 29
2
3d plotting alternatives. I like persp, but regret the lack of plotmath.
I have been making simple functions to display regressions in a new
package called "rockchalk". For 3d illustrations, my functions use
persp, and I've grown to like working with it. As an example of the
kind of things I like to do, you might consult my lecture on
multicollinearity, which is by far the most detailed illustration I've
prepared.
2007 Feb 09
3
two perspective plots in in plot
Dear all,
I would like to put two perspective plots into one plot. The help page
for ?persp shows how one can add points and lines but not another
perspective plot.
data(volcano)
z <- 2 * volcano # Exaggerate the relief
x <- 10 * (1:nrow(z)) # 10 meter spacing (S to N)
y <- 10 * (1:ncol(z)) # 10 meter spacing (E to W)
## Don't draw the grid lines : border = NA
persp(x,
2007 Mar 16
0
How can I place axis annotations away from axis?
Hello Experts
I have the following codes and data for 2 interpolation plots.
http://www.nabble.com/file/7206/3d_plot_data.txt 3d_plot_data.txt
data<-read.table("3d_plot_data.txt", header=T)
attach(data)
par(mfrow=c(1,2))
library(akima)
interpolation<-interp(rr,veg_r,predict)
persp(interpolation,theta = -45, phi = 30, ticktype = "detailed", nticks=4,
cex=0.8,
2010 Apr 30
3
3D Surface plot
Dear All,
I want to create a surface plot from the data. My data set is consists of x,
y and z data.
I plotted in very easy way by Excel worksheet as shown in the attached
picture.
I did some steps in R, but I cannot have the same plot as in Excel
worksheet's figure.
the R code is
x <- c(-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1)
y<- c(-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1)
z<-
2015 Oct 20
3
centos wiki strangeness.
In preparing to answer a question about some yum undesired behavior, I wanted to reference fastest mirror info, but when I went to
https://wiki.centos.org/PackageManagement/Yum/FastestMirror
I find all the text has been squished to the right hand side of the page and made 1 word wide all the way down.
The https://wiki.centos.org/FrontPage looks similar but perhaps it is a little better?
Or is
2008 Jul 03
2
Plotting Prediction Surface with persp()
Hi all
I have a question about correct usage of persp(). I have a simple neural
net-based XOR example, as follows:
library(nnet)
xor.data <- data.frame(cbind(expand.grid(c(0,1),c(0,1)), c(0,1,1,0)))
names(xor.data) <- c("x","y","o")
xor.nn <- nnet(o ~ x + y, data=xor.data, linout=FALSE, size=1)
# Create an (x.y) surface and predict over all points
d <-