title: R: Plotting lasso beta coefficients
body: <p>I wrote this lasso code in R, and I got some beta values:</p>
  
  <pre><code>#Lasso
  library(MASS)
  library(glmnet)
  Boston=na.omit(Boston)
  x=model.matrix(crim~.,Boston)[,-1]
  rownames(x)=c()
  y=as.matrix(Boston$crim)
  lasso.mod =glmnet(x,y, alpha =1, lambda = 0.1)
  beta=as.matrix(rep(0,19))
  beta=coef(lasso.mod)
  matplot(beta,type="l",lty=1,xlab="L1",ylab="beta",main="lasso")
  </code></pre>
  
  <p>I want to plot the betas in a plot like this:</p>
  
  <p><a href="https://i.stack.imgur.com/jxr1n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jxr1n.png" alt="enter image description here"></a></p>
  
  <p>but I don't know what plot function in R I can use to do that. </p>