[R] plot: skip a range of axis

Carl Witthoft carl at witthoft.com
Wed Jan 12 21:53:24 CET 2011

You could always create a new vector, something like

Xprime<- if x<-0 x else x-2   #not valid R code

Thus mapping +1 to -1, and shifting everything else down.  Fixing the 
x-tick labels is left as a homework problem :-)

I'm assuming from your description that there are no y-values 
corresponding to -1<x<1, so plotting y vs Xprime won't lose any of your 


From: Yuan Jian <jayuan2008_at_yahoo.com>
Date: Wed, 12 Jan 2011 04:15:38 -0800 (PST)

thanks Jim,
I found gap.plot seperates x axis or y axis into two boxes. do you know 
any plot tool that can skip a range in x-axis or y-axis without lines?

     * On Wed, 12/1/11, Jim Lemon <jim_at_bitwrit.com.au> wrote:

From: Jim Lemon <jim_at_bitwrit.com.au>
Subject: Re: [R] plot: skip a range of axis To: "Yuan Jian" 
Cc: r-help_at_r-project.org
Received: Wednesday, 12 January, 2011, 10:26 AM

On 01/12/2011 03:46 PM, Yuan Jian wrote:
 > Hi,
 > I am using plot to show scatter points in 2_D.
 > in my data, there is no data between -1 and +1 in x-axis.
 > I want to skip this region, i.e. x axis becomes [-Inf:-1, 1:Inf].
 > can any one tell me how to do?
Hi Yu,
Try the gap.plot function in the plotrix package.


More information about the R-help mailing list