Reputation: 2321
I have four different kinds of graphic, each converted to a grob with apparent success. I am trying to combine them into a single image with grid.arrange(). One of the four -- I would say the simplest of the four -- produces an error, even without the other three.
grid.text(expression(atop("first line",
scriptstyle("second line"))),
vjust = 0, gp=gpar(fontfamily = "HersheySans"))
Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y, :
Metric information not available for this family/device
This is the traceback()
8: grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,
resolveHJust(x$just, x$hjust), resolveVJust(x$just, x$vjust),
x$rot, x$check.overlap)
7: drawDetails.text(x, recording = FALSE)
6: drawDetails(x, recording = FALSE)
5: drawGrob(x)
4: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
3: grid.draw.grob(tg)
2: grid.draw(tg)
1: grid.text(expression(atop("first line", scriptstyle("second line"))),
vjust = 0, gp = gpar(fontfamily = "HersheySans"))
I get the same error if I remove scriptstyle
and vjust
from the function, so they aren't the culprits.
I can't even figure out what function the error comes from. grid.Call.graphics isn't exported, but grid:::grid.Call.graphics
does not have an error message like that in it's code, and neither do as.graphicsAnnot, resolveHJust
, or resolveVJust
.
I've hit the wall on this one. Any ideas or suggestions how to resolve this or get around it much appreciated.
All done under Windows 7.
Upvotes: 1
Views: 571
Reputation: 77116
From ?Hershey
,
You cannot use mathematical expressions (plotmath) with Hershey fonts.
which means that Hershey fonts are incompatible with anything listed in ?plotmath
, such as scriptstyle
, atop
, and of course expression
.
Upvotes: 2