[R] Axis break with gap.plot()

Filoche pmassicotte at hotmail.com
Thu Sep 9 17:07:57 CEST 2010


Hi everyone.

I'm trying to break the y axis on a plot. For instance, I have 2 series
(points and a loess). Since the loess is a "continuous" set of points, it
passes in the break section. However, with gap.plot I cant plot the loess
because of this (I got the message "some values of y will not be
displayed").

Here's my code: 

library(plotrix);


#generate some data
x = seq(-pi,pi,0.1);
sinx = sin(x);

#add leverage value
sinx = c(sinx,10);
xx = c(x,max(x) + 0.1);

#Loess
yy = loess(sinx ~ xx, span = 0.1);
yy = predict(yy);

#Add break between 2 and 8
gap.plot(xx,sinx,c(2,8)); #This line works fine
gap.plot(xx,yy,c(2,8), add = T); #This wont plot the loess

I did the graphic I would like to produce in Sigmaplot.  

http://img830.imageshack.us/img830/5206/breakaxis.jpg

Can it be done in R ?

With regards,
Phil






-- 
View this message in context: http://r.789695.n4.nabble.com/Axis-break-with-gap-plot-tp2533027p2533027.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list