gridgraphics icon indicating copy to clipboard operation
gridgraphics copied to clipboard

grid.echo does not always capture font face

Open clauswilke opened this issue 7 years ago • 1 comments

When reviewing this commit prompted by issue #10, I started wondering whether the font face is properly captured. The answer seems to be "not always". I'm opening a separate issue for this because it's independent of the device issue.

pfun <- function() {
    plot(1:10, 1:10, font = 2, font.lab = 3, font.main = 4,
    xlab = "x axis", ylab = "y axis", main = "Plot title")
}
pfun()
screen shot 2018-03-22 at 12 06 33 am

Here, grid.echo() misses the generic font specification, which applies to the axis tick labels. Plot title and axis labels are correctly styled, however.

grid.echo(pfun)
screen shot 2018-03-22 at 12 06 48 am

Now for 3d plots:

library(plot3D)
pfun2 <- function() {
 par(mar = c(0, 0, 0, 0), mai = c(0, 0.1, 0, 0))
 scatter3D(mtcars$disp, mtcars$hp, mtcars$mpg, colvar = mtcars$cyl,
    	      pch = 19, bty ="b2", theta = 20, phi = 30, colkey = FALSE, 
              xlab = "displacement (cu. in.)", ylab ="power (hp)", zlab = "efficiency (mpg)",
              font.lab = 4)
}
pfun2()
screen shot 2018-03-22 at 12 10 13 am

The font-face setting for the axis labels is lost with grid.echo():

grid.echo(pfun2)
screen shot 2018-03-22 at 12 10 18 am

clauswilke avatar Mar 22 '18 05:03 clauswilke

Fixes for these have been pushed. Thanks again for the reports!

pmur002 avatar Mar 22 '18 21:03 pmur002