gforge / Gmisc

An R package for creating tables, some plots and other useful utilities too small to merit their own package
49 stars 14 forks source link

Mixed font styles in boxGrob #39

Closed aghaynes closed 5 years ago

aghaynes commented 6 years ago

Is it possible to have mixed font styles in a single boxGrob? e.g. something like

Group 1 (N = 10)

This would be a really useful feature...

Thanks, Alan

gforge commented 6 years ago

Interesting feature, I think is that all you need to do is to bypass the lines: https://github.com/gforge/Gmisc/blob/master/R/boxGrobs.R#L30-L61 and replace the txt textGrob with your own grob. I don't have the time right now but I can help you in the process and accept a pull request with the feature.

aghaynes commented 6 years ago

I looked more deeply into whats happening. It's actually much simpler than you suggest. textGrob supports expressions, which in turn support bold/italics and lots of other stuff. All that was needed was to add expression to the list of asserts on label. See my pull request. :)