Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

emptyspace

Find an empty space on a plot


Description

Try to find the largest empty rectangle on a plot.

Usage

emptyspace(x,y=NULL)

Arguments

x,y

x and y positions of the points on the plot.

Details

emptyspace searches the pairs of points on the plot to find the largest rectangular space within which none of the points lie. It does not guarantee that the space will be large enough to fit a legend or text.

Two alternatives are the largest.empty function in the Hmisc package and the maxEmptyRect function. While maxEmptyRect will generally outperform emptyspace, emptyspace will sometimes find a slightly smaller, but "squarer" rectangle.

Value

The x and y coordinates of the center of the rectangle found.

Author(s)

Ray Brownrigg

Examples

x<-rnorm(100)
 y<-rnorm(100)
 plot(x,y,main="Find the empty space",xlab="X",ylab="Y")
 es<-emptyspace(x,y)
 # use a transparent background so that any overplotted points are shown
 boxed.labels(es,labels="Here is the\nempty space",bg="transparent")

plotrix

Various Plotting Functions

v3.8-1
GPL (>= 2)
Authors
Jim Lemon, Ben Bolker, Sander Oom, Eduardo Klein, Barry Rowlingson, Hadley Wickham, Anupam Tyagi, Olivier Eterradossi, Gabor Grothendieck, Michael Toews, John Kane, Rolf Turner, Carl Witthoft, Julian Stander, Thomas Petzoldt, Remko Duursma, Elisa Biancotto, Ofir Levy, Christophe Dutang, Peter Solymos, Robby Engelmann, Michael Hecker, Felix Steinbeck, Hans Borchers, Henrik Singmann, Ted Toal, Derek Ogle, Darshan Baral, Ulrike Groemping, Bill Venables
Initial release
2021-01-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.