[R] Plotting straight line

Adams, Jean jvadams at usgs.gov
Mon Mar 16 20:54:15 CET 2015


Something like this might help you get started.

x <- seq(-5, 5, 1)
m <- seq(0.5, 5, 0.5)
plot(0, 0, type="n", xlab="", ylab="", xlim=range(x), ylim=range(outer(m,
x)+1))
invisible(lapply(m, function(slope) abline(1, slope)))

Jean

On Sun, Mar 15, 2015 at 11:03 PM, Partha Sinha <pnsinha68 at gmail.com> wrote:

> I want to plot a straight line where y=m*x+1 (where x varying from -5
> to +5) and and m will change from 0.5 to 5. All the straight lines
> needs to be overlaid.
> Thanks
> Parth
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list