Skip to content

Multiple formula in one block

2 messages · YiYao_Jiang, Dimitris Rizopoulos

#
Hi Everybody:

I want to draw some chart using command "histogram" and add another curve in it.
Example:

require(stats)
data(singer)
library(lattice)
histogram( ~ height | voice.part, data = singer, nint = 17,  endpoints = c(59.5, 76.5), layout = c(2,4), aspect = .5,  xlab = "Height (inches)")

Now I got a chart of 8 blocks, then I need add :" abline(v=mean(singer$height), col=2, lwd=2) " or any other curve to every block.
How can I do to achieve it. Thanks.
 

Best Regards

YiYao Jiang  

Product Division/ product Testing Department
Semiconductor Manufacturing International Corporation
18 ZhangJiang Road, PuDong New Area, Shanghai  ZIP: 201203
Tel:86-21-5080-2000 Ext. 15173
#
Hi YiYao,

you need the `?panel.abline()' function, somehing like:

panel=function(x, breaks, equal.widths, type, ...){
            panel.histogram(x, breaks, equal.widths, type, ...)
            panel.abline(v=mean(singer$height))
        }

inside the `histogram()' function could do the trick.

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "YiYao_Jiang" <YiYao_Jiang at smics.com>
To: <r-help at stat.math.ethz.ch>
Cc: "YiYao_Jiang" <YiYao_Jiang at smics.com>
Sent: Monday, October 25, 2004 9:16 AM
Subject: [R] Multiple formula in one block