I have a plot from a cva.glmnet() object.
The plot's legend is in the way, and I can't figure out how to move it to the right and give it a legend title.
Here's some sample code that gives a similar issue.
set.seed(100)
a <- runif(1000) %>% round()
b <- runif(1000) %>% round()
c <- runif(1000) %>% round()
d <- runif(1000) %>% round()
datatest <- as.data.frame(cbind(a,b,c,d))
cvtest <- cva.glmnet(d ~ a+b+c, data= datatest, family = "binomial")
plot(cvtest)
Here's a picture of the output:
I've tried adding a legend and using ggplot().

Looks like a bug. We can still set legend coordinates to
NULLand customize alegend.Note, that there's no
ggplot2package involved which is why your attempt didn't work.