michael watson (IAH-C)

2006-Jul-19 10:58 UTC

### [R] Plotting lines and points on the second plot when using gap.plot in plotrix

Hi My question is simple - the gap.plot function in the plotrix package allows users to draw graphs that have a broken axis. However, I want to then add a line to the "second" plot, but can''t. Eg: twogrp<-c(rnorm(10)+4,rnorm(10)+20) gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis="x",xlab="X values", xtics=c(4,7,17,20),ylab="Y values",main="Plot gap on X axis") # this doesn''t work points(17,0,col="red") # this does work points(4,0,col="green") I somehow need to set the focus to the second plot so that I can draw lines and points on it. Any help? Mick

michael watson (IAH-C)

2006-Jul-19 11:11 UTC

### [R] Plotting lines and points on the second plot when usinggap.plot in plotrix

I''ve answered my own question, the x-values of the line/points I want to plot must be adjusted by the gap size Thanks Mick -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of michael watson (IAH-C) Sent: 19 July 2006 11:58 To: r-help at stat.math.ethz.ch Subject: [R] Plotting lines and points on the second plot when usinggap.plot in plotrix Hi My question is simple - the gap.plot function in the plotrix package allows users to draw graphs that have a broken axis. However, I want to then add a line to the "second" plot, but can''t. Eg: twogrp<-c(rnorm(10)+4,rnorm(10)+20) gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis="x",xlab="X values", xtics=c(4,7,17,20),ylab="Y values",main="Plot gap on X axis") # this doesn''t work points(17,0,col="red") # this does work points(4,0,col="green") I somehow need to set the focus to the second plot so that I can draw lines and points on it. Any help? Mick ______________________________________________ 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.

sophykim

2012-Apr-04 20:43 UTC

### [R] Plotting lines and points on the second plot when using gap.plot in plotrix

you need to subtract the length of gap in y-axis. Good luck! -- View this message in context: http://r.789695.n4.nabble.com/Plotting-lines-and-points-on-the-second-plot-when-using-gap-plot-in-plotrix-tp804226p4533129.html Sent from the R help mailing list archive at Nabble.com.