I use the glmnet package to get the following graph from the mtcars dataset (mpg regression for other variables):
library(glmnet) fit = glmnet(as.matrix(mtcars[-1]), mtcars[,1]) plot(fit, xvar='lambda')

How can I add variable names to each curve, either at the beginning of each curve, or at its maximum point y (as far away from the x axis)? I tried, and I can add a legend, as usual, but not the inscription on each curve or at the beginning. Thank you for your help.
(PS: If you find this question interesting / important, please vote for it;)
rnso source share