Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

largest.empty does not return largest empty area #136

Open
chrisdane opened this issue Oct 12, 2020 · 0 comments
Open

largest.empty does not return largest empty area #136

chrisdane opened this issue Oct 12, 2020 · 0 comments

Comments

@chrisdane
Copy link

Hi

In a specific case Hmisc::largest.empty(x, y, method="area") does not return the largest empty rectangle (code example Hmisc_largest.empty_example.txt):

Hmisc_largest empty_example

The area of Hmisc::largest.empty (blue) is 1078482. The area of my own 'by-eye' rectangle (red) is 1855670, i.e. much larger. Do I misunderstand something here? The important lines are

# x, y see attached .txt file
plot(x,y)
library(Hmisc)
tmp <- Hmisc::largest.empty(x=x, y=y, method="area")
rect(tmp$rect$x[1], tmp$rect$y[1], tmp$rect$x[2], tmp$rect$y[3], border="blue")
rect(par("usr")[1], -2600, par("usr")[2], -1200, border="red")
message("Hmisc blue area: ", tmp$area)
# Hmisc blue area: 1078482.91586984
message("own red area: ", diff(par("usr")[1:2])*diff(c(-2600, -1200)))
# own red area: 1855670.95159074

Thanks a lot for any help,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant