Displaying 1 result from an estimated 1 matches for "mypanel_v1".
Did you mean:
mypanel_v2
2012 Jul 29
1
Zoo panel function
...ngth.out=100)
y = sin(x)
zobj = zoo(y, x)
###########################################################
## EXAMPLE 1 - GLOBAL ARGUMENT
## This panel function works
## But, it relies on mycol, which is a global variable
###########################################################
palette(rainbow(100))
mypanel_v1 = function(x, y, ...){
lines(x, y, lty=2, col='grey')
points(x, y, col=mycol, pch=16)
}
mycol = round((y - min(y)) / (max(y) - min(y)) * 99) + 1
plot(zobj, panel=mypanel_v1)
###########################################################
## EXAMPLE 2 - PASSING IN MY_COLOR AS PARAM (WITH WARNI...