Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0602131243560.29951-100000@reclus.nhh.no>
Date: 2006-02-13T11:47:05Z
From: Roger Bivand
Subject: Adding dimnames to image()
In-Reply-To: <79799E69EA1DA246A51F983B5663BEA2CD34CF@server2.hq.clientvela.net>

On Mon, 13 Feb 2006, Markus Preisetanz wrote:

> Dear Colleagues,
> 
>  
> 
> does anybody know how to add dimnames to an image. Right now I'm using 
> 

I think you are looking for axis labels - they are taken by default from 
your missing x and y arguments. Try something like:

image(matrix(rnorm(200), 10, 20), axes=FALSE)
axis(1, at=seq(0,1,length.out=10), labels=LETTERS[1:10])
axis(2, at=seq(0,1,length.out=20), labels=letters[1:20])
box()

I guess you'll want to set par(mar=) to give a bit more space, and maybe 
rotate the labels too.

>  
> 
> image(as.matrix(df3), col=brewer.pal(9,"Blues"))
> 
>  
> 
> where df3 is a data.frame.
> 
> dimnames(as.matrix(df3)) delivers
> 
>  
> 
> [[1]]
> 
>  [1] "RFM_A1" "RFM_A2" "RFM_A4" "RFM_A5" "RFM_A7" "RFM_B3" "RFM_B6" "RFM_B7" "RFM_B8" "RFM_B9" "RFM_C2" "RFM_C5" "RFM_C7"
> 
> [14] "RFM_D5" "RFM_D7" "RFM_D8" "RFM_A3" "RFM_A6" "RFM_B1" "RFM_B2" "RFM_B4" "RFM_B5" "RFM_C1" "RFM_C3" "RFM_C4" "RFM_C6"
> 
> [27] "RFM_C8" "RFM_C9" "RFM_D1" "RFM_D2" "RFM_D3" "RFM_D4" "RFM_D6" "RFM_D9"
> 
>  
> 
> [[2]]
> 
> [1] "Clus1" "Clus2" "Clus3" "Clus4" "Clus5" "Clus6" "Clus7"
> 
>  
> 
> The entries in the cells of the matrix are numeric.
> 
>  
> 
> All I get are axises with decimal numbers ranging from 0 to 1.
> 
>  
> 
> Thank you, sincerely
> 
> ___________________
> 
> Markus Preisetanz
> 
> Consultant
> 
>  
> 
> Client Vela GmbH
> 
> Albert-Ro??haupter-Str. 32
> 
> 81369 M??nchen
> 
> fon:          +49 (0) 89 742 17-113
> 
> fax:          +49 (0) 89 742 17-150
> 
> mailto:markus.preisetanz at clientvela.com <mailto:markus.preisetanz at clientvela.com> 
> 
> 
> 
> Diese E-Mail enth??lt vertrauliche und/oder rechtlich gesch??tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt??mlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
> 
> This e-mail may contain confidential and/or privileged infor...{{dropped}}
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no