[R] Tweaking my plot of matrix as image

Petr PIKAL petr.pikal at precheza.cz
Thu Apr 12 11:36:43 CEST 2007


Did you by chance look at the help page of image? If you did, you could 

locations of grid lines at which the values in z are measured. These must 
be finite, non-missing and in (strictly) ascending order. By default, 
equally spaced values from 0 to 1 are used. If x is a list, its components 
x$x and x$y are used for x and y, respectively. If the list has component 
z this is used for z.
a matrix containing the values to be plotted (NAs are allowed). Note that 
x can be used instead of z for convenience.

and therefore

image(1:20, 1:20, your.matrix)

shall do what you probably want. And if you have different matrix size 


can give you suitable sequence.


Petr Pikal
petr.pikal at precheza.cz

r-help-bounces at stat.math.ethz.ch napsal dne 12.04.2007 10:55:21:

> Greetings list,
> I have a rectangular 20 x 20 matrix with values in the range of [0 , 
> 1]. I'd like to plot it as an image. To that end, I have used the 
> image() function that seems to do what I want. Now, I just want to 
> tweak it to look perfect. So here is my question:
> At the moment, the values of the axis range from [0, 1]. I want it to 
> show the row and column of the matrix. How do I do that?
>   Thanks in advance.
> Wee-Jin
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list