[R] r graphing

R. Michael Weylandt michael.weylandt at gmail.com
Thu Apr 12 01:06:22 CEST 2012


Alternatively, you can use

curve(x^3, from = -5, to = 5); abline(h = 0, v = 0, lty = 2)

which will work even if the axes aren't in the middle of the image.

Michael

On Wed, Apr 11, 2012 at 6:54 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
> Please reply all to the list and don't send HTML.
>
> curve(x^3, from = -5, to = 5); grid()
>
> If you only want dotted lines at x = 0 & y = 0 use
>
> grid(2,2)
>
> instead.
>
> Michael
>
> On Wed, Apr 11, 2012 at 6:49 PM, John Kim <provicon2000 at yahoo.com> wrote:
>> thanks for the reply..
>>
>> i tried the code below.. it shows the graph.. but how do i make x and y axis
>> show up in the middle??
>>
>> i am teaching secondary school math.. and i need to produce graphs for
>> learning purpose..
>>
>> i need nice x- y-axis.. in the middle.. with arrows at the end of axis..
>>
>> can you tell me how i can realize that??
>>
>> john
>>
>>
>> From: R. Michael Weylandt <michael.weylandt at gmail.com>
>> To: John Kim <ktown4989 at gmail.com>
>> Cc: r-help at r-project.org; provicon2000 at yahoo.com
>> Sent: Wednesday, April 11, 2012 2:37 PM
>> Subject: Re: [R] r graphing
>>
>> The easiest way is to just use ?curve (type ?curve at the prompt to
>> get documentation for curve): e.g., curve(x^3, from = -5, to = 5)
>>
>> You could also build the plot yourself like:
>>
>> x <- seq(-5, 5, length.out = 200)
>> y <- x^3
>>
>> plot(x,y)
>>
>> Michael
>>
>> On Wed, Apr 11, 2012 at 4:41 PM, John Kim <ktown4989 at gmail.com> wrote:
>>> can anybody tell me how i can draw x- y- axis and draw x^3 graph using
>>> R graph??
>>>
>>> i need nice coordinate system with legends and coordinate
>>> numberings..
>>>
>>> and nice graph of x^3 on it..  it will be nice if you tell me how i
>>> can center the graph..
>>>
>>> i want the origin (0,0) to be right in the middle of the graph.
>>>
>>> thank you so much.
>>>
>>> ______________________________________________
>>> 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.
>>
>>



More information about the R-help mailing list