0

How do I adjust the overall size of a ggplot?

I'm using Shiny, thus, I'd like to control the size of my plot. I'd like one of my plots to be the size of a postage stamp. And, I'd like the plot next to it to be huge.

From what I can tell, no matter how much I play with scale_x_continuous or xlim or cartesian_coord or whatnot, I'm still stuck with a ggplot that has made up it's own mind on how big it wants to be. I can squish down the amount of ink within the size of the plot, or I can fill up the insides of the plot by using various attributes, but I can't change the number of pixels the plot takes up on my screen.

How can I specify the exact number of pixels I would like my plot to be?

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149

1 Answers1

1

I don't know shiny, but maybe this helps,

library(grid)
print(qplot(1,1), vp=viewport(width=unit(114,"points"), height=unit(1.4,"inch")))
baptiste
  • 75,767
  • 19
  • 198
  • 294
  • I'm heartbroken, `package ‘grid’ is not available (for R version 3.1.1)` – tumultous_rooster Dec 19 '14 at 01:07
  • @MattO'Brien don't worry, you (most likely) already have it installed, it comes bundled with R most of the time. No need to install it from CRAN, where it is not, anyway. – baptiste Dec 19 '14 at 01:28