Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify Width and Height of Plot

Tags:

I have a panel containing three plots. How can I use par to specify the width and height of the main panel so it is always at a fixed size?

like image 210
Ryan R. Rosario Avatar asked Aug 14 '09 17:08

Ryan R. Rosario


2 Answers

You do that in the device, e.g.

x11(width=4, height=6) 

and similarly for the file-based ones

pdf("/tmp/foo.pdf", width=4, height=6) 

You can read the physical size via par("cin") etc but not set it.

like image 124
Dirk Eddelbuettel Avatar answered Sep 22 '22 14:09

Dirk Eddelbuettel


I usually set this at the start of my session with windows.options:

windows.options(width=10, height=10)  # plot away plot(...) 

If you need to reset to "factory settings":

dev.off() windows.options(reset=TRUE)  # more plotting plot(...) 
like image 34
ars Avatar answered Sep 21 '22 14:09

ars