Re: [R] plot only x- and y-axis with origin, no box()

From: Talloen, Willem [PRDBE] <WTALLOEN_at_PRDBE.JNJ.COM>
Date: Wed, 20 Jun 2007 10:08:22 +0200

perfect Romain,
box( bty = "l", lwd = 2 )
is the solution !
thank you all for your kind responses,
willem

-----Original Message-----
From: Romain Francois [mailto:rfrancois_at_mango-solutions.com] Sent: Wednesday, 20 June 2007 10:01
To: Talloen, Willem [PRDBE]
Subject: Re: [R] plot only x- and y-axis with origin, no box()

Talloen, Willem [PRDBE] wrote:
> 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)
>>
Hi Willem ,

In that case, I would go with a vanilla `plot` call and then add `axis` and `box` low-level function calls:

plot( 5:10, 5:10, axes = FALSE  )
axis( 1, lwd = 2, .. )
axis( 2, lwd = 2, .. )

box( bty = "l", lwd = 2 )

Cheers,

Romain

> 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.
>
>

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

______________________________________________
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.
Received on Wed 20 Jun 2007 - 08:13:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Jun 2007 - 08:32:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.