How to create a Budget line in excel or R
Another R code that does it...

m &lt;- 100
p &lt;- c(1, 2) 
curve(m/p[2] - p[1]/p[2]*x, from = 0, to = m/p[1], lwd = 2,
      xlab = expression(x[1]),
      ylab = expression(x[2]))