Skip to content
Prev 170715 / 398506 Next

how to control the overall shape of a figure?

on 02/16/2009 07:51 PM Oliver wrote:
The overall shape of the plot region is controlled by par("pty"), which
is set to "m" by default, for 'maximal' plotting region.

Set this to "s" to create a square plot region. For example:

par(mfrow = c(1, 2), pty = "s")
plot(1)
plot(1)


In order to do this with a PDF file, ensure that the overall plot
dimensions are in the proper relative aspect ratio. For example:

pdf(file = "SquarePlots.pdf", height = 4, width = 8)
par(mfrow = c(1, 2), pty= "s")
plot(1)
plot(1)
dev.off()

This will create 2 square plots, side-by-side, within an overall plot
size of 4x8. You can further adjust the plot margins and other
characteristics as may be required.

See ?par and ?Devices for more information regarding these
customizations and options to set size arguments for specific devices.

HTH,

Marc Schwartz