| sculpt3d.setCallback {sculpt3d} | R Documentation |
Sets a callback function to be called after select/crop/delete commands. The callback function could be used to call/update additional plots using selection/current points in the current sculpt3d rgl plot.
To disable the callback, simply pass NULL.
sculpt3d.setCallback(callback = NULL)
callback |
Callback function. The function should accept arguments of 'current' and 'selected' as logical vectors, and 'selected_color' as the selection color:sculpt3d.setCallback(f = (current, selected, selected_color){...}) |
Called for the side effect of calling the corresponding callback function passed as an argument.
Justin Donaldson
## Not run:
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
sculpt3d(x, y, z, labels=1:1000, col=rainbow(1000), type='s', radius=runif(1000)/5, alpha = .5)
f = function(current, selected, selected_color) {
plot(x[current],y[current],type='n') # set plot dimensions
points(x[current & !selected],z[current & !selected]) # current points
points(x[selected],z[selected], col=selected_color) # selected points
}
sculpt3d.setCallback(f)
# now select/crop/delete using the toolbar to see the auxiliary 2d plot update itself
## End(Not run)