[Rd] SVG Error on Windows if Multiplication Character Present

Dario Strbenac d@tr7320 @end|ng |rom un|@@ydney@edu@@u
Wed Apr 7 10:00:05 CEST 2021


Good day,

The example below fails on Windows with Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y: Metric information not available for this family/device.

library(ggplot2)
aPlot <- ggplot(ToothGrowth, aes(x = factor(dose), y = len)) + geom_boxplot() +
         ggtitle("Test", subtitle = ggplot2::expr(paste("p", " = ", "6.23", " × ", "10"^"-5"))) 
svg("test.svg"); aPlot; dev.off();

but there is no such problem on a Debian Linux server. The plot in Windows appears fine in an R graphics window. The error only occurs when exported as an SVG file. Using %*% instead of × avoids the error but it's perhaps worth mentioning in case it could be easily handled by R.

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia


More information about the R-devel mailing list