Re: [R] image() and nonsquare matrices

From: Greg Snow <Greg.Snow_at_intermountainmail.org>
Date: Tue 16 Jan 2007 - 20:19:01 GMT


Look at the "squishplot" function in the TeachingDemos package. Does this set of commands work for you?

> library(TeachingDemos)
> squishplot(c(0.5,20.5),c(0.5,5.5),1)
> image(1:20,1:5,a,asp=1,xlab="label here")
> box()

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Robin Hankin
> Sent: Friday, January 12, 2007 3:13 AM
> To: RHelp help
> Subject: [R] image() and nonsquare matrices
>
> How do I draw non-square matrices with image() and get the axes right?
>
>
> Try 1:
>
> a <- matrix(rnorm(100),20,5)
> image(1:20,1:5,a,asp=1,xlab="label here") # No good because
> the axes don't touch the image
>
>
>
> Try 2:
>
> image(1:20,1:5,a,asp=1,axes=F,xlab="label here")
> axis(side=1,pos=0)
> # No good because the x axis label is floating far from the x axis.
>
>
>
> Try 3:
> image(1:20,1:5,a,asp=1,axes=F,xlab="",ylab="")
> axis(side=1,pos=0)
> # No good because the x axis label is absent.
>
>
> How to use image() with a non-square matrix and make axes and
> labels appear correctly?
>
>
>
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton European Way,
> Southampton SO14 3ZH, UK
> tel 023-8059-7743
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Wed Jan 17 07:26:27 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 16 Jan 2007 - 21:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.