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

Check for empty lines after clipping #22

Merged
merged 1 commit into from
May 3, 2021

Conversation

paleolimbot
Copy link

Fixes #21. I think this is straightforward since you already check this in the same way before clipping.

I don't see a place where this was tested but would be happy to add a test if you can think of a good way to do it!

library(isoband)
library(grid)

m <- matrix(c(0, 0, 0, 0, 0, 0,
              0, 0, 0, 1, 1, 0,
              0, 0, 1, 1, 1, 0,
              0, 1, 1, 0, 0, 0,
              0, 0, 0, 1, 0, 0,
              0, 0, 0, 0, 0, 0), 6, 6, byrow = TRUE)

df_lines <- isolines((1:ncol(m))/(ncol(m)+1), (nrow(m):1)/(nrow(m)+1), m, 0.5)
grob_lines <- isolines_grob(
  df_lines,
  gpar(fontsize = 1000),
  label_placer = label_placer_manual("0.5", 0.5, 0.5, 0)
)

grid.newpage()
grid.draw(grob_lines)

Created on 2021-05-03 by the reprex package (v2.0.0)

@clauswilke
Copy link
Collaborator

Yes, that's an obvious fix. Not sure how to test this, since this code is only run upon drawing. It's probably fine without.

@clauswilke clauswilke merged commit 44691dc into r-lib:master May 3, 2021
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

Successfully merging this pull request may close these issues.

Drawing an isolines_grob() fails when the label covers the entire line
2 participants