# NOT RUN {
## Plotting Function
# For 'lattice' graphics:
# WRONG:
# f <- function(x, ...) xyplot(x~sin(x), ...)
# CORRECT:
# f <- function(x, ...) print(xyplot(x~sin(x), ...))
f <- function(x, ...) plot(x, sin(x), col=2, type="l", ...)
# Save the plot as "Sine_Function.pdf" in the current folder
# and add a title to the plot
plotAndSave(f, "Sine_Function", x=seq(-pi, pi, length=100),
main="Sine-Function", format="pd")
# }
Run the code above in your browser using DataLab