Displaying 20 results from an estimated 8000 matches similar to: "Persp and color (again)"
2003 Sep 17
3
Fractals in R and having fun! (and more persp and color)
Well, I started playing with fractals in R, and wrote a function to
generate de Mandelbrot set, which might
be of interest to some people
###########################################################################
# Mandelbrot set
###########################################################################
mandelbrot <- function(x = c(-3.0, 1.0), # x coordinates
y =
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
2007 Sep 10
1
persp() problem
I am having some trouble getting the persp() package to change the x
and y axis on a 3d plot. It defaults to the [0,1] interval and when I
try to change it I get errors.
Example:
This works:
------------
D <- c(1,2,3,4,5,6,7,8,9,10)
M <- c(11,12,13,14,15,16,17,18,19,20)
DM <- cbind(D,M)
persp(DM, theta = 40, phi = 30, expand = 0.5, col = "lightblue",
ltheta = 120,
2002 Apr 23
1
Bug: persp and colors (PR#1476)
Full_Name: Oliver Niggemann
Version: Windows 1.4 patched
OS: Windows NT 4.0
Submission from: (NULL) (141.169.250.14)
Hello,
I am working with the persp command. I want to change to color of the facets
according
to their z-value. The colors seems to be transposed, i.e. the color of a facet A
seems
to be used for a facet B which is a (defined?) way off....
An example:
nx <- 21
ny <- 21
2012 Jun 19
2
Smoothing a persp graph
Hi,
I'm unable to find a way to smooth data for a persp() graph.
Example, suppose that I have data x,y,z like this:
x <- 1:10
y <- 1:10
k <- 20
z <- outer(x, y, "*") + matrix( k*runif(100, -1, 1), 10, 10)
persp(x, y, z, theta = 35, phi = 25)
The graph is not very nice. Is there a way to smooth the z data so that at the end the graph would look more like something
2003 Sep 01
0
Re: Plotting bivariate normal distributions.
You'll find that it is a lot easier to do it in R:
# lets first simulate a bivariate normal sample
library(MASS)
bivn <- mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1, .5, .5, 1), 2))
# now we do a kernel density estimate
bivn.kde <- kde2d(bivn[,1], bivn[,2], n = 50)
# now plot your results
contour(bivn.kde)
image(bivn.kde)
persp(bivn.kde, phi = 45, theta = 30)
# fancy contour with
2004 Aug 10
1
persp, array and colors
Dear R-users,
I'd like to plot a three-dimensional surface and at the meantime I'm using
an array. I would like to have the values of my first matrix in the heights
of the plot and the colors of the single facet taking into account the
second matrix.
I hope that the next code will help all of you to understand better my
issue,
Thanks in advance, Giancarlo
############################
##
2011 Mar 18
0
keep color range constant across three persp() graphs
Hi All.
I have created two, 3-D, color graphs using persp(). Z values range from 1
to 100 on the first plot, and 0.5 to 50 on the second plot.
I would like to keep the color range constant between the two graphs, rather
than each graph showing the full range of colors.
So the first graph should go from yellow to red and the second graph should
go from yellow to orange.
Below I present a
2011 Nov 17
1
White lines on persp plots in pdf format
Hi,
I am using the persp function to plot 3D surfaces, but the plots have
"little white lines" when I print them to a pdf file (visible in
Acrobat, Foxit, Evince, Xpdf and Gimp). This does not happen when I
create png or tiff images. Here is some sample code:
pdf("test.pdf")
x <- seq(0,1,length=101)
f <- dnorm(x, 0, 0.25)
z <- c()
for(i in 1:100) z <-
2005 Feb 01
0
persp plots axis tick-labels
Hi R-listers,
I am having trouble with persp plotting and I hope some knowledgeable
person can help me. I have searched the help files to no avail. I am sure
there is a way of achieving this simple task. I thought in par maybe but
that seems not to work for 3d plots. Maybe I have missed something.
I read in ?persp that it expects increasing values for both my x and y
axes, and a matrix
2002 Nov 04
0
persp(), x- and y-axis with character strings
Dear R list,
I want to plot the yield curve in a 3D graph: the x-axis refers to time; the
y-axis refers to the maturities and the z-axis are the yields.
The following code works fine:
persp(y, x, as.matrix(ypper), xlab="Last 50 periods", ylab="Maturities
(months)",zlab="Yields",
zlim=c(3,6),theta=130, phi=15, col="Seagreen", box=T,
2000 Oct 26
2
persp plot question..
Dear All,
I have been trying to to do this for a few days now. I can generate
persp plot OK and can generate it in colour using the command
persp(x,y,z,col=terrain.colors(20))
However, I was wondering if it is possible to shade the 3d surface like a
contour plot. i.e. black for large z, white for small z, say
Thanks in advance
Colin
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
2009 Nov 22
1
"Over-coloring" facets on persp() plot
Dear R Community:
Recently, I have managed to plot some really useful graphs of my
research data using persp(). I have even figured out how to overplot
rectangular regions (corresponding to submatrices) with a different
color. This is accomplished by using par(new=T). I am now searching
for a way to "highlight" a set of (possibly non-contiguous) facets with
a specific color,
2006 Aug 06
1
extractAIC using surf.ls
Although the 'spatial' documentation doesn't mention that extractAIC
works, it does seem to give an output.
I may have misunderstood, but shouldn't the following give at least
the same d.f.?
> library(spatial)
> data(topo, package="MASS")
> extractAIC(surf.ls(2, topo))
[1] 46.0000 437.5059
> extractAIC(lm(z ~ x+I(x^2)+y+I(y^2)+x:y, topo))
[1]
2002 Mar 28
1
persp + postscript/pdf (PR#1419)
persp(outer(1:5, 1:5), shade=0.1)
looks nice on the screen, but
postscript()
persp(outer(1:5, 1:5), shade=0.1)
dev.off()
gives an all black surface.
same when using the pdf() device. has already been like that in 1.4.0.
.f
--please do not edit the information below--
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status = Under development
2003 Apr 29
1
polynomial fitting
I'm trying to find a way to fit a polynomial of degree n in x and y to
a set of x, y, and z data that I have and obtain the coefficients for
the terms of the fitted polynomial. However, when I try to use the
surf.ls function I'm getting odd results.
> x <- seq(0, 10, length=50)
> y <- x
> f <- function (x, y) {x^2 + y}
> library(spatial)
> test <-
2003 Jun 01
1
persp & colors
Dear R experts!
I use image() & persp() functions for color plotting z(x,y)-type
graphics. In image() colors correspond to z-values, that's what
I want. OTOH, in persp() the col option means:
col: the color(s) of the surface facets. Transparent colours are
ignored. This is recycled to the (nx-1)(ny-1) facets.
but I'd like to persp()' colors behave like in
2009 May 27
1
contour lines on persp plot
Hello folks,
I am a beginner R user. I have been able to make a 3D surface plot using
'persp'. The surface is made by a grid of lines emanating perpendicularly
from each of the x and y axes at regular intervals.
I can get rid of that grid by setting 'border=NA'.
Can anyone suggest some ways to replace the grid with contour lines, to
create a 3-dimensional contour map?
Thanks
2009 Nov 23
1
Natural colours for topographic data
Dear list members
I'm currently working on some topographic (elevation) data, and was
somewhat surprised that the 'topo.colors' and 'terrain.colors' are of
little to no use here.
The problem is that these functions only return a palette of colours;
they don't map depth values to colours. So if I plot (using 'image',
'persp' or similar functions) and