I am generating multiple plots using lapply to retrieve data from a vector for each of the plots.
Problem:
- I need to plot the
ablinefor each graph, but it plots only in the last one. - Ideally, I would also plot a different title for each of the graphs.
Data:
perfsis a vector with 3 elements and each of its elements contains the main data for the plot.- Each item in perfs corresponds to a value of
k, that has been previously defined in the vectorks = c(5,7,11)
I have tried adding arguments to lapply.
lapply(perfs, function(perf) {plot(perf, main = paste0("Curva ROC", ks), col = "#42f4bf", lwd = 4)})
abline(a = 0, b = 1, lwd = 2, lty = 2)
Actual:
ablineonly in the last plot.- The title repeated for each of the
kin every plot:ROC Curve5 ROC Curve7... - This is the last plot:

Expected:
- Title: ROC Curve 5 ; ROC Curve 7...
ablinein each graph