# [R] image() and nonsquare matrices

Greg Snow Greg.Snow at intermountainmail.org
Tue Jan 16 21:19:01 CET 2007

```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 at intermountainmail.org
(801) 408-8111

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at 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 at 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.
>

```