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

unit comparison with arithmetic units #15

Closed
wants to merge 1 commit into from
Closed

unit comparison with arithmetic units #15

wants to merge 1 commit into from

Conversation

baptiste
Copy link
Contributor

compare.unit fails with arithmetic units:

s1 <- max(grobWidth(textGrob("a")), grobWidth(textGrob("1")))
s2 <- max(grobWidth(textGrob("a")), grobWidth(textGrob("2")))
gtable:::compare.unit(s1, s2, pmin)
unit.pmin(s1, s2)

Better use unit.pmax and unit.pmin I think.

…Grob("a")), grobWidth(textGrob("1"))); gtable:::compare.unit(s1, s1, pmin); unit.pmin(s1, s2)`). Better use `unit.pmax` and `unit.pmin` I think.
@hadley
Copy link
Member

hadley commented Feb 26, 2012

Is there a reason you modified rbind rather than fixing the problem in compare.unit?

@baptiste
Copy link
Contributor Author

not really; on a practical side it meant that i only needed to change one function (outside of the namespace). Also, I thought compare.units might have had a more general function (beyond pmin and pmax). Essentially, compare.units becomes redundant, unless it has other uses?

That said, I'm happy to change compare.units instead.

@hadley
Copy link
Member

hadley commented Jun 7, 2012

The problem with unit.pmin and unit.pmax is that they return units which are computed at render-time, which tends to be slow.

@baptiste
Copy link
Contributor Author

baptiste commented Jun 7, 2012

I'm not sure there's an alternative around that; if gtable is to be a general layout framework you'll always have these complex units that need to be computed on-the-fly (I needed them for the tableGrob function I was developing). Is it really so slow that it matters?

@baptiste
Copy link
Contributor Author

any updates on this, and gtable development in general? So many people request on SO how to align two plots / gtables, and this particular issue is the only thing that prevents rbind_gtable and cbind_gtable from being the best answer.

@hadley
Copy link
Member

hadley commented Jul 1, 2013

We're busy on other projects at the moment, but will hopefully come back to this in the not too distant future.

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.

None yet

2 participants