| To: | <s-news@lists.biostat.wustl.edu> |
|---|---|
| Subject: | Calling xyplot from inside a function. |
| From: | "Paul Lasky" <phlasky@earthlink.net> |
| Date: | Tue, 4 Jul 2006 09:10:53 -0700 |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=AZpnYYwVKMz5IBMec+0l+SnsVdoHRjm10WPSKbcw2SD/+jEF4kUIx926TIrMuJOt; h=Received:From:To:Subject:Date:MIME-Version:Content-Type:X-Mailer:X-MimeOLE:Thread-Index:Message-ID:X-ELNK-Trace:X-Originating-IP; |
| Thread-index: | AcafhGxr3EJOJ/5tTGay5RuLfjEb9Q== |
|
I know this is
another tiresome "scoping" question, but I can't seem to get a Trellis plot
with panel functions to work when called from a function:
What I
want to do is graph prob density, put some quantile vertical lines on the
graph, and place some text on the graph labeling the vertical lines; the
following code (without attempting the labeling) doesn't
work:
myFunction =
function( obj ) {
#
den = density( obj$score,
n=100, width = 29 )
quant = quantile( obj$score, c( 0.1, 0.5,
0.9 ) )
main2 = "My
Stuff"
#
xyplot( den$y ~ den$x, xlab="Points", type = "l",main = main2, col = 1,
panel = function(x, y)
{
panel.abline( v = quant, lty = 2 )
}
)
}
Also what is the code for Labeling the
vertical quantile lines with text at the bottom such as " 10%",
"Median", "90%"?
A panel.text
function isn't available.
Producing this plot within a function is easy to do with the
old-fashioned plot function. But Trellis plots seem to be so difficult to
work with that, frankly, most of the time they aren't worth the
effort. In this instance, however it would be desirable from a publication
standpoint to produce a Trellis
plot.
Paul
Lasky
P & B
Consultants.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | AIC for analyses of a huge dataset, Marcos Texeira |
|---|---|
| Next by Date: | Re: Calling xyplot from inside a function., Thom Burnett |
| Previous by Thread: | AIC for analyses of a huge dataset, Marcos Texeira |
| Next by Thread: | Re: Calling xyplot from inside a function., Thom Burnett |
| Indexes: | [Date] [Thread] [Top] [All Lists] |