[R] [lattice xyplot] Help needed in help in customizing the panel.abline() function
Dieter Menne
dieter.menne at menne-biomed.de
Thu Dec 9 08:36:23 CET 2010
Girish A.R. wrote:
>
> Sorry, just realized that there was a typo in the following code of my
> original post. The correct code is as shown below (corrected
> 'data=swtop16' to 'data=DF'):
>
> sales <- xyplot(pct_inv_left ~ week_num|sku_num, data=DF,type =
> "l",lwd=2,panel = function(...) {
> panel.abline(h = 75, lty = 2)
> panel.xyplot(...)
> })
>
>
If it is really a constant not dependent on grouping, you could compute it
in the parent; or, better probably, compute it in panel.abline()
Dieter
.. Your data here ...
maxWeek = DF$week_num[which.max (DF$cnt_gt50pct_disc)]
sales <- xyplot(pct_inv_left ~ week_num|sku_num, data=DF,type =
"l",lwd=2,panel = function(...) {
panel.abline(h = 75, lty = 2)
panel.abline(v = maxWeek, lty = 2)
panel.xyplot(...)
})
print(sales)
--
View this message in context: http://r.789695.n4.nabble.com/lattice-xyplot-Help-needed-in-help-in-customizing-the-panel-abline-function-tp3079656p3079698.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list