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.
On Apr 11, 2012, at 4:41 PM, John Kim 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..Look at: ?curve> > 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.David Winsemius, MD West Hartford, CT
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.
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. > >
I repeat myself: Please reply all to the list and don't send HTML. I'm not aware of facilities to do that automatically (though others might now them) -- you can draw arrows manually with the arrows() function. Michael On Wed, Apr 11, 2012 at 7:08 PM, John Kim <provicon2000 at yahoo.com> wrote:> thank you so much.. > > is it possible to make arrows show up at the end of axis.. and make > numberings show up in the middle axis?? > > From: R. Michael Weylandt <michael.weylandt at gmail.com> > To: John Kim <provicon2000 at yahoo.com>; r-help <r-help at r-project.org> > Sent: Wednesday, April 11, 2012 4:06 PM > Subject: Re: [R] r graphing > > 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. >>> >>> > >