new approach to custom grid grobs

29 views
Skip to first unread message

Paul Murrell

unread,
Oct 29, 2012, 8:17:05 PM10/29/12
to ggplo...@googlegroups.com
Hi

I have committed to r-devel some experimental changes to how grid grobs can be customised (essentially an alternative set of hook methods, makeContext() and makeContent(), to use instead of preDrawDetails() and drawDetails()).

There is a document describing the motivation for the change and various examples of usage at http://www.stat.auckland.ac.nz/~paul/R/customGridRedesign.pdf

The document includes an example of how 'gtable' classes could be reimplemented with this new design, plus a small discussion of the resulting benefits (see pages 26-29 of the document)

I have done some testing to check that things still work and I think the changes are worth it, but any further testing and feedback would be extremely welcome.

Paul

Paul Murrell

unread,
Oct 29, 2012, 8:24:34 PM10/29/12
to ggplo...@googlegroups.com

P.S.  the suggested changes are in a 'gtable' fork on github (https://github.com/pmur002/gtable);  please let me know if there's a better way I could provide/present these changes.


Hadley Wickham

unread,
Oct 30, 2012, 10:08:52 AM10/30/12
to Paul Murrell, ggplo...@googlegroups.com
Looks cool - thanks Paul!

I don't think we can pull in the changes for a while though, since the
new (unofficial) ggplot2 policy is to try and stick with compatibility
with the current and previous versions of R.

Hadley
--
RStudio / Rice University
http://had.co.nz/
Message has been deleted

Paul Murrell

unread,
Oct 30, 2012, 3:22:12 PM10/30/12
to ggplo...@googlegroups.com, Paul Murrell
Fair enough.  Any "offical" integration would have to wait until post R 2.16.0 anyway, but are you thinking longer term than that?

What level of compatibility are you shooting for?  Just identical output (which this change is supposed to achieve), or something deeper?

In the meantime, I recall that Winston (?) had a nice-looking visual test suite going;  is there any way that I could try that out with this change?

Paul

Winston Chang

unread,
Oct 30, 2012, 3:44:52 PM10/30/12
to Paul Murrell, ggplo...@googlegroups.com
On Tue, Oct 30, 2012 at 2:20 PM, Paul Murrell <pmu...@gmail.com> wrote:


On Wednesday, October 31, 2012 3:09:13 AM UTC+13, Hadley Wickham wrote:
Looks cool - thanks Paul!

I don't think we can pull in the changes for a while though, since the
new (unofficial) ggplot2 policy is to try and stick with compatibility
with the current and previous versions of R.
Fair enough.  Any "offical" integration would have to wait until post R 2.16.0 anyway, but are you thinking longer term than that?

What level of compatibility are you shooting for?  Just identical output (which this change is supposed to achieve), or something deeper?

In the meantime, I recall that Winston (?) had a nice-looking visual test suite going;  is there any way that I could try that out with this change?


Sure! At the moment, the vtest package is only on github:
 You can install it with
  install_github('vtest', 'wch')

There's information about it here:


Here's an example of a result set generated by vtest:
And here's a diff set generated by vtest, comparing results from two different git commits:

That reminds me - it expects your project to have a git repository, and it won't work without one.


The examples above were tests of ggplot2. But you probably will want to use it with grid graphics The gtable tests are a better example to start from:
The output looks like this:

Good luck!
-Winston

Hadley Wickham

unread,
Oct 30, 2012, 4:53:57 PM10/30/12
to Paul Murrell, ggplo...@googlegroups.com
> Fair enough. Any "offical" integration would have to wait until post R
> 2.16.0 anyway, but are you thinking longer term than that?

If it won't be available until R 2.16, then I'd prefer to wait until R
2.16.1 (.2?).

> What level of compatibility are you shooting for? Just identical output
> (which this change is supposed to achieve), or something deeper?

As plyr and ggplot2 become more widely used, the development process
is getting more conservative. Part of this is avoiding features that
appeared in the latest version of R (which is a pain if you're in an
environment that can only upgrade yearly). I haven't started doing
any formal testing, but it's on my long-term horizon.

Hadley

Paul Murrell

unread,
Oct 30, 2012, 6:07:40 PM10/30/12
to ggplo...@googlegroups.com, Paul Murrell

Thanks Winston!  I'll have a go.

Paul Murrell

unread,
Oct 30, 2012, 6:10:35 PM10/30/12
to ggplo...@googlegroups.com, Paul Murrell
OK.  I'll make myself a reminder to revisit this after R 2.16.0 is out.
Reply all
Reply to author
Forward
0 new messages