demo_light <- function(light = darken_face, ...) {
df <- data.frame(x=1, y=1, z=1)
grid::grid.newpage()
grid.oblicubes(df, ..., light=light, angle=45, lwd=4,
vp = grid::viewport(0.25, 0.25, 0.5, 0.5))
grid.oblicubes(df, ..., light=light, angle=135, lwd=4,
vp = grid::viewport(0.75, 0.25, 0.5, 0.5))
grid.oblicubes(df, ..., light=light, angle=-45, lwd=4,
vp = grid::viewport(0.25, 0.75, 0.5, 0.5))
grid.oblicubes(df, ..., light=light, angle=-135, lwd=4,
vp = grid::viewport(0.75, 0.75, 0.5, 0.5))
}
demo_light()
demo_light(fill = "gold")
demo_light(light = function(face, col)
darken_face(face, col, top = 0.3,
west = 0.6, east = 0.6,
south = 0.0, north = 0.0)
)
demo_light(light = function(face, col) {
n <- length(col)
switch(face,
top = rep_len("grey90", n),
west = rep_len("red", n),
east = rep_len("green", n),
south = rep_len("blue", n),
north = rep_len("yellow", n))
})
Run the code above in your browser using DataLab