Thanks to Tom for this. It was simpler than I thought. Apparently "at" 
will do the trick very simply.  It was not entirely clear to me (from 
the help pages) whether the axis parameters can operate independently of 
the dimensions/resolution of the diagrams....

Here is an example for future ref.:

    par(mfrow=c(1,2))
    p<-100
    n<-100
    z<-matrix(rnorm(100*100),100,100)
    
image(x=1:p,y=1:n,t(z),col=c("white","red"),xlab="column",ylab="row",main="Actual
 
100x100")
   
    
image(x=1:p,y=1:n,t(z),axes=FALSE,col=c("white","red"),xlab="column",ylab="row",main="Pretending
 
to be 2345x2345")
    axis(1,at=seq(1,100,length=5),labels=seq(0,2345,length=5))
    axis(2,at=seq(1,100,length=5),labels=seq(0,2345,length=5))

Thanks again to all who replied.


Mulholland, Tom wrote:

> There's something that you're not telling me. If you want something 
> other than your data, why use your data. If you have another set of 
> data that you wish to overlay on the image then you are going to have 
> to scale one of the data sources to match the other. I'm not sure 
> where your problem is but the code below might prove useful in you 
> understanding how the plotting occurs. I assume that image always use 
> the -.25, 1.25 limits, but this would need to be confirmed.
>  
> I assume that when you talk about trying to use label, you are 
> referring to the Hmisc package. I don't use this function so I can't 
> give advice about it. However I think you probably need to be more 
> familiar before you will get the best out of Frank's package. Someone 
> else on the list may be able to help in the use of this function.
>  
> x<-matrix(c(1,1,0,1,0,1,0,1,1),3,3)
>  
> # dummy secondary data
> y <- runif(20) * 20
> z <- runif(20) * 20
> y1 <- (y/(20/1.5)) - 0.25 # rescale y from 0 to 20 to -.25 to 1.25
> z1 <- (z/(20/1.5)) - 0.25
> x;y;z;y1;z1
>  
> par(mfrow = c(1,3))
> image (x,xlim =c(-0.25,1.25),ylim = c(-0.25,1.25))
>
> image(x,xlim =c(0,0.5),ylim = c(0.1,0.9),axes = FALSE)
> points(y1,z1)
>
> image (x,axes = FALSE,xlim =c(-0.25,1.25),ylim = c(-0.25,1.25))
> points(y1,z1)
> rect(0,0.1,0.5,0.9)
> axis(2,at = seq(-0.25,1.25,length = 5),labels = seq(0,20, length = 5))
>  
> Tom
>
>  -----Original Message-----
> *From:* Costas Vorlow [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, 12 January 2005 6:22 PM
> *To:* Mulholland, Tom
> *Subject:* Re: [R] Changing the ranges for the axis in image()
>
>     Dear Tom,
>
>     Thanks. What happens though If I want an entirely different range
>     than that of my data? I am trying with label() but it doesn't work
>     properly.
>
>     Best,
>     Costas
>
>     Mulholland, Tom wrote:
>
>>Setting Axes = FALSE does not remove the axes, you can therefore still set 
>>the limits using xlim and ylim.
>>
>>x<-matrix(c(1,1,0,1,0,1,0,1,1),3,3)
>>par(mfrow = c(1,2))
>>image (x)
>>image(x,xlim =c(0.5,0.8),ylim = c(0.1,0.9),axes = FALSE)
>>
>>
>>Tom
>>
>>  
>>
>>>-----Original Message-----
>>>From: Costas Vorlow [mailto:[EMAIL PROTECTED]
>>>Sent: Tuesday, 11 January 2005 9:29 PM
>>>To: [email protected]
>>>Subject: [R] Changing the ranges for the axis in image()
>>>
>>>
>>>Dear all,
>>>
>>>I can not find/understand the solution to this from the help pages:
>>>
>>>Say we have the following script:
>>>
>>> x<-matrix(c(1,1,0,1,0,1,0,1,1),3,3)
>>>image(x)
>>>
>>>How can I change the ranges on the vertical and horizontal axis to a 
>>>range of my own or at least place a box frame around the image if I 
>>>choose to use "axes=FALSE"?
>>>
>>>Apologies for such a bsic question and thanks beforehand for 
>>>your answers.
>>>
>>>______________________________________________
>>>[email protected] mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide! 
>>>http://www.R-project.org/posting-guide.html
>>>
>>>    
>>>
>>
>>
>>  
>>
>


        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to