[R] Plot of function seems to cut off near edge of domain
chad.mills
chad.mills at gmail.com
Tue Mar 27 07:17:53 CEST 2012
Hello helpful R folks,
I am simply trying to graph a quarter circle centered at the origin in the
first quadrant. When I set the xlim of the plot to the radius of the
circle, the plot appears correct. However, I'd like to see a slight
extension of the axes beyond the domain of the function itself. When I do
this, a portion of the plot seems to be missing by the edge of the domain.
Here is the code for both of the plots:
dev.off()
plot.new()
#Set up two-figure plot
par(mfrow=c(1,2),pty='s')
g<-function(x){sqrt(2500-x^2)}
#Figure 1, with xlim at the radius of the circle
plot(g,axes=F,xlim=c(0,50),ylim=c(0,50))
axis(1,pos=0)
axis(2,pos=0)
#Figure 2, with xlim beyond the radius of the circle
plot(g,axes=F,xlim=c(0,60),ylim=c(0,60))
axis(1,pos=0)
axis(2,pos=0)
Notice that the second graph doesn't appear to intersect the x-axis, while
the first one does. Any ideas why that might be the case? Here's an image
of what I see in case that's useful:
http://r.789695.n4.nabble.com/file/n4507954/Cut_off_Quarter_Circle.png
Thanks in advance for the help!
-Chad Mills
--
View this message in context: http://r.789695.n4.nabble.com/Plot-of-function-seems-to-cut-off-near-edge-of-domain-tp4507954p4507954.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list