I am searching for a command to draw a line in R on a blank sheet of defined length. For example a line that is exactly 2.55 cm long.
Does anyone know if there is such a tool?
CodePudding user response:
The following code will write a pdf comprising a single A4 page with a 2.55cm line drawn on it 10cm from the bottom of the page:
library(grid)
pdf('mypdf.pdf', width = 8.25, height = 11.75)
grid.newpage()
line <- linesGrob(x = unit(c(10, 12.55), 'cm'), y = unit(c(10, 10), 'cm'))
grid.draw(line)
dev.off()