Skip to content
Prev 83163 / 398506 Next

Plot problems: xlim

Hi,

I believe Jim Lemon's solution requires his plotrix package.

Maurice Haynes
National Institutes of Health
Child and Family Research Section


-----Original Message-----
From: Jim Lemon [mailto:bitwrit at ozemail.com.au] 
Sent: Friday, December 23, 2005 10:12 PM
To: Ronnie Babigumira
Cc: R Help
Subject: Re: [R] Plot problems: xlim
Ronnie Babigumira wrote:
running with no luck (and a pile of hair on my desk) so
have 99 points, bound in the range
like to add to the plot as a line and to do this I
naturally, the line I want to add is not plotted since it
hence the need to add xlim however this produces
out into a very lean "bell" shape.
yet also be able to add my xline.
Hi Ronnie,

For only one line, it is probably easiest to stick in an axis break and 
label the line on the x axis. Notice that the position of the line is 
arbitrarily set to be far enough beyond the end of the density curve to 
allow room for the axis break.

testdata<-rnorm(50,sd=0.01)
denz<-density(testdata)
plot(denz,xlim=c(-0.02,0.04),axes=FALSE)
box()
axis(1,at=c(-0.02,0,0.02,0.039),labels=c(-0.02,0,0.02,0.2454959))
abline(v=0.039)
axis.break(1,breakpos=0.037)

This is probably a common enough problem for inclusion in the axis.break

example.

Jim

______________________________________________
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