Skip to content

Doesn't try to combine labels if labels are NULL #4115

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

Merged
merged 2 commits into from
Jul 4, 2020

Conversation

eliocamp
Copy link
Contributor

@eliocamp eliocamp commented Jul 3, 2020

I encountered this strange error. It took me a while to get a reprex because it is incredibly elusive.

library(ggplot2)

grid <- expand.grid(x = seq(0, 360, by = 2.5), y = seq(-90, -20, by = 2.5))
grid$z <- with(grid, x^2*y)

ggplot(grid, aes(x, y)) +
  geom_contour(aes(z = z)) +
  coord_polar() +
  scale_x_continuous(breaks = seq(0, 360, by = 30), labels = NULL)
#> Error in labels[[n]] <- combined: attempt to select less than one element in integerOneIndex

The issue was that coord_polar() tries to combine labels even if they are NULL. I added a check. All tests succeed and the bug is fixed.

@clauswilke
Copy link
Member

A test seems to be failing on R devel. Could you see if you can figure out why?

@yutannihilation Is there a reason we check R devel only on macOS? Makes it difficult to figure out whether a problem is related to R devel or to macOS. I think we should check at least on ubuntu also.

@eliocamp
Copy link
Contributor Author

eliocamp commented Jul 3, 2020

Some visual test unrelated to this change are failing. Might have to do with fonts or some other platform-specific reason?

══ testthat results  ═══════════════════════════════════════════════════════════
[ OK: 1515 | SKIPPED: 19 | WARNINGS: 1 | FAILED: 58 ]
1. Error: aesthetics are drawn correctly (@test-aes.r#160) 
2. Error: alpha is drawn correctly (@test-aes.r#175) 
3. Error: segment annotations transform with scales (@test-annotate.r#30) 
4. Error: cartesian coords draws correctly with limits (@test-coord-cartesian.R#25) 
5. Error: cartesian coords draws correctly with clipping on or off (@test-coord-cartesian.R#56) 
6. Error: USA state map drawn (@test-coord-map.R#7) 
7. Error: coord_map scale position can be switched (@test-coord-map.R#16) 
8. Error: polar coordinates draw correctly (@test-coord-polar.r#96) 
9. Error: basic coord_trans() plot displays both continuous and discrete axes (@test-coord-transform.R#99) 
1. ...

@clauswilke
Copy link
Member

Looks like the failing tests are vdiffr tests. Maybe some graphics related detail has changed in R devel?

@yutannihilation
Copy link
Member

yutannihilation commented Jul 3, 2020

Because R devel is not yet available on Linux.

c.f. r-lib/actions#49 (comment)

@yutannihilation
Copy link
Member

Let me handle the CI issue on #4116. I'm sure the failure is unrelated to this PR.

@clauswilke clauswilke merged commit 31572dc into tidyverse:master Jul 4, 2020
@clauswilke
Copy link
Member

Thanks!

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.

3 participants