[R] plot only x- and y-axis with origin, no box()
Talloen, Willem [PRDBE]
WTALLOEN at PRDBE.JNJ.COM
Wed Jun 20 08:52:23 CEST 2007
Yes Greg,
Your provided solution does the job;
> plot(5:10, 5:10, bty='n')
> library(TeachingDemos)
> lines(cnvrt.coords( c(0,0,.5), c(.5,0,0), input='plt')$usr)
The easy way is indeed to do
> plot(.., bty='l')
but this cannot be used in combination with fixing tickmarks and changing width of the axes.
HOWEVER, there is still a small error. The width of the added y-axis has not the same width;
> plot(5:10, 5:10,axes=F)
> axis(1,lwd=2)
> axis(2,lwd=2)
> library(TeachingDemos)
> lines(cnvrt.coords( c(0,0,.5), c(.5,0,0), input='plt')$usr,lwd=2)
Any ideas?
Willem
-----Original Message-----
From: Greg Snow [mailto:Greg.Snow at intermountainmail.org]
Sent: Tuesday, 19 June 2007 18:23
To: Talloen, Willem [PRDBE]; r-help at stat.math.ethz.ch
Subject: RE: [R] plot only x- and y-axis with origin, no box()
Try:
> plot(.., bty='l')
Does that do what you want? (see the bty parameter in ?par for details)
If you don't want the lines extending beyond the axes on the right and
top then you could do something more like:
> plot(5:10, 5:10, bty='n')
> library(TeachingDemos)
> lines(cnvrt.coords( c(0,0,.5), c(.5,0,0), input='plt')$usr)
You may also get what you want by playing with the xaxp and yaxp
parameters to par, but the bty='l' seems the easiest way to go.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> Talloen, Willem [PRDBE]
> Sent: Tuesday, June 19, 2007 7:15 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] plot only x- and y-axis with origin, no box()
>
> hi all,
>
> I'm trying for quite some time to have an x- and y-axis, but
> no entire box.
>
> >plot(..,axes=F)
> >axis(1)
> >axis(2)
> Gives this, but their axes do not go to the origin.
> Quite a number of people find this gap between the two axes
> disturbing.
> Has anyone an idea how to let these axes go to the origin?
>
> thank you in advance
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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