I try to use more than one question with (gg)plots in an R-exam using exams2nops()
.
However, the first plot seems to be cached and displayed instead of all further plots, too.
Edit: with "more than one question" I meant an exam with several questions containing plot per person and each of them with randomized differences between persons.
The templates available on the R/exams web page provide several examples how to include randomized graphics in the exercises. As a concrete example see: http://www.R-exams.org/templates/scatterplot/.
This uses base graphics for producing the scatterplot. If you want to use ggplot2
instead you can replace the "scatterplot" chunk plot(x, y)
, e.g., with:
d <- data.frame(x = x, y = y)
library("ggplot2")
theme_set(theme_minimal())
ggplot(d, aes(x = x, y = y)) + geom_point()
Both yield the desired randomized output.