[R] [FORGED] Plot step function

jupiter jupiter.hce at gmail.com
Sun Feb 7 23:54:48 CET 2016


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 general, there are parameters to define
Δx (i.e Δx= 1), and to define [0, 0.0] at the joint of x axis and y axis.
But never mind, if it is too much to ask :-).

Thank you and greatly appreciate kind responses.

- j



On Mon, Feb 8, 2016 at 8:19 AM, Jim Lemon <drjimlemon at gmail.com> wrote:

> 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 <jupiter.hce at gmail.com> 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]?
>>
>> On Sun, Feb 7, 2016 at 5:29 AM, Rolf Turner <r.turner at auckland.ac.nz>
>> 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
>> >> 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
>> > University of Auckland
>> > Phone: +64-9-373-7599 ext. 88276
>> >
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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