Re: [R] image plot with color scale

2013-11-19 Thread Jim Lemon
On 11/19/2013 10:07 PM, Witold E Wolski wrote: I am plotting an image of correlations but need to add a color scale... dat<-matrix(rnorm(1000),ncol=5) labels=c("a","b","c","d","e") cortmp<- cor(dat) image(cortmp , axes = F ) axis( 1, at=seq(0,1,length=length(labels)) , labels=labels , cex.axis=

Re: [R] image plot but data not on grid.

2010-08-09 Thread Hadley Wickham
With sweave, you need to explicitly print() the output of ggplot2 and lattice plots. Hadley On Mon, Aug 9, 2010 at 6:32 AM, W Eryk Wolski wrote: > qplot does (?) what I was looking for! > At least it plots what I want to plot in the interactive modus. > However, it seems not to work with Sweave.

Re: [R] image plot but data not on grid.

2010-08-09 Thread W Eryk Wolski
qplot does (?) what I was looking for! At least it plots what I want to plot in the interactive modus. However, it seems not to work with Sweave. Thanks On 7 August 2010 16:15, Michael Bedward wrote: >> If it's regular, but incomplete, that method will work.  If it's >> irregular, then no imag

Re: [R] image plot but data not on grid.

2010-08-07 Thread Michael Bedward
> If it's regular, but incomplete, that method will work.  If it's > irregular, then no image method will work without first interpolating > a regular grid. Thanks Hadley. As I suspected, but ggplot2 is so very clever that I thought it was worth asking :) Michael ___

Re: [R] image plot but data not on grid.

2010-08-07 Thread Hadley Wickham
On Sat, Aug 7, 2010 at 2:54 AM, Michael Bedward wrote: > On 7 August 2010 06:26, Hadley Wickham wrote: > >> library(ggplot2) >> qplot(x, y, fill = z, data = df, geom = "tile") > > Hi Hadley, > > I read the original question as being about irregularly spaced data. > The above method doesn't seem to

Re: [R] image plot but data not on grid.

2010-08-07 Thread Michael Bedward
On 7 August 2010 06:26, Hadley Wickham wrote: > library(ggplot2) > qplot(x, y, fill = z, data = df, geom = "tile") Hi Hadley, I read the original question as being about irregularly spaced data. The above method doesn't seem to for me in such a case but perhaps I'm constructing my example incorr

Re: [R] image plot but data not on grid.

2010-08-06 Thread Hadley Wickham
On Fri, Aug 6, 2010 at 9:24 AM, W Eryk Wolski wrote: > Hi, > > Would like to make an image > however the values in z are not on an uniform grid. > > Have a dataset with > length(x) == length(y) == length(z) > x[1],y[1] gives the position of z[1] > > and would like to encode value of z by a color.

Re: [R] image plot but data not on grid.

2010-08-06 Thread David Winsemius
On Aug 6, 2010, at 10:24 AM, W Eryk Wolski wrote: Hi, Would like to make an image however the values in z are not on an uniform grid. Have a dataset with length(x) == length(y) == length(z) x[1],y[1] gives the position of z[1] and would like to encode value of z by a color. looking for some

Re: [R] image plot but data not on grid.

2010-08-06 Thread Martyn Byng
Hi, Not really sure what you are after, but the following plots a series of points of varying colour plot(x,y,type='n') apply(cbind(x,y,z),1,function(a) {points(a[1],a[2],col=a[3],pch=".")}) but its going to be really slow for a large number of points Martyn -Original Message- From: r-

Re: [R] image plot

2009-08-25 Thread Jim Lemon
ogbos okike wrote: Hi, I am trying to use the image function to do a color plot. My matrix columns are labeled y and x. I tried >image(y, x) but I had error message ("Error in image.default(y, x) : increasing 'x' and 'y' values expected"). Could anybody please tell me how to add these increasing

Re: [R] image plot

2009-08-24 Thread Paul Hiemstra
ogbos okike schreef: Hi, I am trying to use the image function to do a color plot. My matrix columns are labeled y and x. I tried >image(y, x) but I had error message ("Error in image.default(y, x) : increasing 'x' and 'y' values expected"). Could anybody please tell me how to add these increasin

Re: [R] image() plot with z not in matrix format

2007-11-29 Thread Julian Burgos
Hello Marc, Well, image() requires data values in a regular grid. So you need to interpolate your data to a regular grid before you do your plot. There are many interpolation methods, but a good place to start is to do linear interpolation. You should first use expand.grid() to create the r