To draw a "crossed" rectangle 2 times its width, using the low-level graphics packages that I call:
xlim <- c(0, 500) ylim <- c(0, 1000) plot.new() plot.window(xlim, ylim, asp=1) rect(xlim[1], ylim[1], xlim[2], ylim[2]) lines(c(xlim[1], xlim[2]), c(ylim[1], ylim[2])) lines(c(xlim[1], xlim[2]), c(ylim[2], ylim[1]))
The drawing has a nice feature: the aspect ratio is preserved, so if I change the size of the chart window, I get the same proportions between the width and the width.
How to get an equivalent result with grid graphics?
r plot r-grid
cenka
source share