Re: [R] [FORGED] Plot step function

2016-02-08 Thread jupiter
Thanks Jeff, I've already added color and lwd to make it visible. I know it is not the optimal thing to do, but I was required. Cheers. On Tue, Feb 9, 2016 at 3:11 AM, Jeff Newmiller wrote: > R by default puts the axes at the edge of the plot, not at x=0 and y=0, > for the reason that doing oth

Re: [R] [FORGED] Plot step function

2016-02-08 Thread Jeff Newmiller
R by default puts the axes at the edge of the plot, not at x=0 and y=0, for the reason that doing otherwise makes the plot harder to read. To see this, consider: plot( c( -4, 0, 4 ), c( 0, 1, 1 ), type="s", xlab="x", ylab="y", axes=FALSE, xlim=c( -5, 5 ), ylim=c( -2, 2 ), lwd=2 ) axis( side=1,

Re: [R] [FORGED] Plot step function

2016-02-07 Thread jupiter
Thanks Jim, that was I did to generate graphic from plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y"), it displayed [-4, -2, 0, 2, 4] in X, I tried to twist it, but could not get [-4, -3, -2, -1, 0, 1, 2, 3, 4] in X. Also, that the y 0.0 is above the X axis. I guess I try to figure out if, in ge

Re: [R] [FORGED] Plot step function

2016-02-07 Thread Jim Lemon
Hail Jupiter, Might a slight alteration of Rolf's suggestion do the trick? plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y") Jim On Sun, Feb 7, 2016 at 8:49 AM, jupiter wrote: > Thank you for the all response, how can the point y (0.0) on the same x > axis, and X increases 1 between [-4, 4]

Re: [R] [FORGED] Plot step function

2016-02-06 Thread jupiter
Thank you for the all response, how can the point y (0.0) on the same x axis, and X increases 1 between [-4, 4]? On Sun, Feb 7, 2016 at 5:29 AM, Rolf Turner wrote: > On 07/02/16 01:11, jupiter wrote: > >> Hi, >> >> I am just starting to learn R, sorry for asking a simple question. How can >> plo

Re: [R] [FORGED] Plot step function

2016-02-06 Thread Bert Gunter
All of which should suggest: 1. Before posting further, spend some time with an R tutorial or two. "An Intro to R" ships with R; and links to some of the many excellent web resources can be found here: https://www.rstudio.com/resources/training/online-learning/#R 2. Search! A web search of "pl

Re: [R] [FORGED] Plot step function

2016-02-06 Thread Rolf Turner
On 07/02/16 01:11, jupiter wrote: Hi, I am just starting to learn R, sorry for asking a simple question. How can plot a line x <= 0 y = 0, x > 0 y = 1? One way: plot(c(-1,0,1),c(0,1,1),type="s",xlab="x",ylab="y") cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics Un