Search code examples
rplot3d

cex parameter in the plot3D library


I cannot find any indication on how to use the cex parameter when plotting image2D. It seems the cex parameter does not have any effect. I am able to change the font size of the legend and the axis with the specific cex arguments, but I cannot change the plot title font size.

Is there a way to change font size over the plot with just one parameter? And how is the title font size changed?


Solution

  • You are right, I did not find it in documentation as well. To change title font size you can set the parameter cex.main in image2D. See below:

    library(plot3D)
    nr <- nrow(volcano)
    nc <- ncol(volcano)
    image2D(volcano, x = 1:nr, y = 1:nc, lighting = TRUE, 
            main = "volcano", clab = "height, m", cex.main = 3)
    

    Title Font Size Increase

    To scale up the font size globally you can change global parameter cex. Please see below:

    library(plot3D)
    nr <- nrow(volcano)
    nc <- ncol(volcano)
    
    prev <- par(cex = 1.7)
    image2D(volcano, x = 1:nr, y = 1:nc, lighting = TRUE, 
            main = "volcano", clab = "height, m")
    
    par(prev)
    

    All labels increased