Lekgatlhamang, lexi Setlhare
2012-Jul-19 21:31 UTC
[R] A graph with a positive y-axis intercept
Dear all, I have a challenge with a supposedly simple graph (a scatter). I wanted to use R to create a plot/graph with a positive y-axis intercept but it does not seem to give me what I expect to see. As an example, I used the following values> X<- c(0, 4, 8, 11) > Y<- c(8, 12, 15, 22)then I used the plot function in the base package> plot(X, Y)This gave me a graph which might be mistaken to be starting from the origin, and yet, using the same numbers in Excel, and plotting them using the scatter option, I get a graph which clearly has a positive y-axis intercept. Please help. Lexi [[alternative HTML version deleted]]
Your question is not entirely clear to me, but I think you might want: plot(X, Y, xlim=c(0, 25), ylim=c(0, 25)) Sarah On Thu, Jul 19, 2012 at 5:31 PM, Lekgatlhamang, lexi Setlhare <lexisetlhare at yahoo.com> wrote:> Dear all, > > I have a challenge with a supposedly simple graph (a scatter). I wanted to use R to create a plot/graph with a positive y-axis intercept but it does not seem to give me what I expect to see. As an example, I used the following values > >> X<- c(0, 4, 8, 11) >> Y<- c(8, 12, 15, 22) > > then I used the plot function in the base package > >> plot(X, Y) > > This gave me a graph which might be mistaken to be starting from the origin, and yet, using the same numbers in Excel, and plotting them using the scatter option, I get a graph which clearly has a positive y-axis intercept. > Please help. > > Lexi-- Sarah Goslee http://www.functionaldiversity.org
HI, I guess you wanted to change the scale of Y-axis: ?plot(X,Y,ylim=c(0,25)) A.K. ----- Original Message ----- From: "Lekgatlhamang, lexi Setlhare" <lexisetlhare at yahoo.com> To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> Cc: Sent: Thursday, July 19, 2012 5:31 PM Subject: [R] A graph with a positive y-axis intercept Dear all, ? I have a challenge with a supposedly simple?graph (a scatter). I wanted to use R to create a plot/graph with a positive y-axis intercept but it does not seem to give me what I expect to see. As an example, I used the following values ?> X<- c(0, 4, 8, 11) > Y<- c(8, 12, 15, 22)then I used the plot function in the base package ?> plot(X, Y)? This gave me a graph which?might be mistaken?to be starting from the origin, and yet, using the same numbers in Excel, and plotting them using the scatter option, I get a graph which clearly has a positive y-axis intercept. Please help. ? Lexi ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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.
Seemingly Similar Threads
- Adjusting length of series
- Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
- Export Results
- kerberos_kinit_password host/SUNDEV@LEXI.COM.MX failed: Client not found in Kerberos database
- pls help: lattice graph with both negative and positive value, x and y cross at 0 and negative value bars are plotted just oppositive direction in contrast to positive