[R] Drawing functions on Cartesian coordinate systems

Paul Smith phhs80 at gmail.com
Fri Sep 28 21:19:04 CEST 2007


On 9/28/07, Greg Snow <Greg.Snow at intermountainmail.org> wrote:
> I think he wants the axes crossing at 0,0 not on the outer edges like
> the default.
>
> You can put the axes in the plot (though it tends to distract rather
> than help in many cases) by:
>
> > axis(1, pos=0)
> > axis(2, pos=0)
>
> You will need to draw the arrowheads yourself.  There are options (under
> ?par) for tick length and how to suppress the default axes.

Thanks, Greg, for your suggestion. That is in line with what I was
looking for. However, I still have  one more question. Take the
following code:

curve(sin(x),-pi,pi,axes=F,ylab="",xlab="")
axis(1, pos=0)
axis(2, pos=0,at=c(-1,-0.5,0.5,1))

How can I have the y axis labels rotated clockwise?

Paul





> > -----Original Message-----
> > From: r-help-bounces at r-project.org
> > [mailto:r-help-bounces at r-project.org] On Behalf Of Charles Annis, P.E.
> > Sent: Friday, September 28, 2007 11:32 AM
> > To: 'Paul Smith'; 'r-help'
> > Subject: Re: [R] Drawing functions on Cartesian coordinate systems
> >
> > Yes, R can do that.  Well, actually YOU can do that using R.
> >
> > But it is hard to believe that you looked very hard before
> > writing.  Did you look at these R functions?
> >
> > ?plot
> > ?line
> > ?points
> > ?arrows
> >
> >
> >
> > Charles Annis, P.E.
> >
> > Charles.Annis at StatisticalEngineering.com
> > phone: 561-352-9699
> > eFax:  614-455-3265
> > http://www.StatisticalEngineering.com
> >
> > -----Original Message-----
> > From: r-help-bounces at r-project.org
> > [mailto:r-help-bounces at r-project.org] On Behalf Of Paul Smith
> > Sent: Friday, September 28, 2007 1:12 PM
> > To: r-help
> > Subject: [R] Drawing functions on Cartesian coordinate systems
> >
> > Dear All,
> >
> > Can R draw plots of functions on a Cartesian coordinate
> > system with axes like the ones shown at
> >
> > http://en.wikipedia.org/wiki/Image:Cartesian-coordinate-system
> > -with-circle.s
> > vg
> >
> > ?
> >
> > I have already searched the R web-site, but found nothing.
> >
> > Thanks in advance,
> >
> > Paul
> >
> > ______________________________________________
> > 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.
> >
> > ______________________________________________
> > 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