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

Partal matching #5654

Closed
eliocamp opened this issue Jan 20, 2024 · 5 comments · Fixed by r-lib/gtable#94
Closed

Partal matching #5654

eliocamp opened this issue Jan 20, 2024 · 5 comments · Fixed by r-lib/gtable#94
Labels
bug an unexpected problem or unintended behavior

Comments

@eliocamp
Copy link
Contributor

eliocamp commented Jan 20, 2024

I'm preparing to send ggnewscale to CRAN and part of my test is warning against partial matching. This caught an issue that bubbled up from ggplot2 and probably gtable.

I'm preparing to send ggnewscale to CRAN and part of my test is warning against partial matching. This caught an issue that bubbled up from ggplot2 and probably gtable.

library(ggplot2)
options(warnPartialMatchDollar = TRUE)
options(warn = 2) 

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = factor(year)))
#> Error in vp$just: (converted from warning) partial match of 'just' to 'justification'

traceback (don't know how to print it automatically in the reprex)

  (converted from warning) partial match of 'just' to 'justification'
20.
doWithOneRestart(return(expr), restart)
19.
withOneRestart(expr, restarts[[1L]])
18.
withRestarts({
.Internal(.signalCondition(simpleWarning(msg, call), msg,
call))
.Internal(.dfltWarn(msg, call)) ...
17.
.signalSimpleWarning("partial match of 'just' to 'justification'",
base::quote(vp$just))
16.
valid.just(just)
15.
vpObject(x, y, width, height, valid.just(just), gp, clip, mask,
xscale, yscale, angle, layout, layout.pos.row, layout.pos.col,
name)
14.
valid.viewport(x, y, width, height, just, gp, clip, mask, xscale,
yscale, angle, layout, layout.pos.row, layout.pos.col, name)
13.
viewport(name = name, x = vp$x, y = vp$y, width = vp$width, height = vp$height,
just = vp$just, gp = vp$gp, xscale = vp$xscale, yscale = vp$yscale,
angle = vp$angle, clip = vp$clip)
12.
gtable(widths = width, heights = heights, name = name, vp = vp,
rownames = names(grobs))
11.
gtable_col(name = "guides", grobs = grobs, width = max(widths),
heights = heights, vp = vp) at guides-.R#680
10.
package_box(...) at ggproto.R#180
9.
(structure(function (...)
package_box(...), class = "ggproto_method"))(grobs = dots[[1L]][[4L]],
position = dots[[2L]][[4L]], theme = structure(list(line = structure(list(
colour = "black", linewidth = 0.5, linetype = 1, lineend = "butt", ...
8.
mapply(FUN = f, ..., SIMPLIFY = FALSE)
7.
Map(grobs = grobs, position = names(grobs), self$package_box,
MoreArgs = list(theme = theme)) at guides-.R#517
6.
assemble(..., self = self) at ggproto.R#180
5.
plot$guides$assemble(theme) at plot-build.R#185
4.
ggplot_gtable.ggplot_built(data) at plot-build.R#170
3.
ggplot_gtable(data) at plot.R#206
2.
print.ggplot(x)
1.
(function (x, ...)
UseMethod("print"))(x)

Created on 2024-01-20 with reprex v2.0.2

@teunbrand
Copy link
Collaborator

Yeah I noticed this too in your tests. I had a hard time figuring out what the root cause of this was, and still haven't.

@teunbrand
Copy link
Collaborator

I'm now pretty much convinced that it is a gtable thing. It tries to extract the vp$just element, but its true name is vp$justification. Somewhere in the viewport() constructor, the just argument is set as a justification element in a list.

library(gtable)
library(grid)
options(warnPartialMatchDollar = TRUE)
options(warn = 2) 

gtable(
  widths = unit(1, "cm"),
  heights = unit(1, "cm"),
  vp = viewport()
)
#> Error in vp$just: (converted from warning) partial match of 'just' to 'justification'

Created on 2024-01-20 with reprex v2.1.0

@yutannihilation
Copy link
Member

@teunbrand teunbrand added the bug an unexpected problem or unintended behavior label Jan 23, 2024
@teunbrand
Copy link
Collaborator

Thanks for the confirmation! As this is a gtable issue, I've put in a PR at gtable, see r-lib/gtable#94. Should we close this issue here?

@yutannihilation
Copy link
Member

Thanks for the PR! As there's nothing we can do on ggplot2's side, I agree we can close this issue.

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants