title: How do I conditionally change the aspect ratio of charts in R's Shiny package?
body: <p>Just playing with <a href="http://rstudio.github.com/shiny/tutorial/" rel="noreferrer">Shiny</a> and loving it already. But how do I get charts in the reactivePlot / plotOutput combination to be of different sizes depending on which chart is plotted?</p>
  
  <p>In this first example, I have selected the "Yield curve" analysis and get the aspect ratio I want:</p>
  
  <p><img src="https://i.stack.imgur.com/mJNPZ.png" alt="enter image description here"></p>
  
  <p>But when I choose another analysis, in this case a heatmap, it is now the same size as the "Yield Curve" chart which distorts it (cells should be square, not rectangular). </p>
  
  <p><img src="https://i.stack.imgur.com/5hpDL.png" alt="enter image description here"></p>
  
  <p>How can I change the chart size depending on which chart has been selected? I've tried putting the height parameter = NA, NULL or "" but it doesn't like any of those. </p>
  
  <p>Separately, but in the same application, how can I get some whitespace between the top selectInput and the textInputs in the sidebarPanel? I have tried h4("  ") but doesn't work. </p>
  
  <p>Here is my ui.R:</p>
  
  <pre><code>library(shiny)
  
  shinyUI(pageWithSidebar(
      headerPanel(h1("SAGB Relative Value Tool")),
      sidebarPanel(
          h4("Choose analysis:"),
          selectInput("analysis1", "", 
              choices = c("Yield curve", "Optical asset swap spreads", 
                          "Cheap dear box", "Cheap dear charts", "Switch signaliser", 
                          "Barbells")),
          h4(" "),
          h4("Yield override:"),
          lapply(bondNames, function(x)
              textInput(paste(x, "bond"), x, last(sagb$sagb)[x]))
      ),
      mainPanel(
          h3(textOutput("AnalysisHeader")),
          plotOutput("AnalysisOutput", height = "10in"))
  ))
  </code></pre>
  
  <p>and here is my server.r</p>
  
  <pre><code>library(shiny)
  
  shinyServer(function(input, output) {
  
      output$AnalysisHeader  &lt;- reactiveText(function() {
          input$analysis1
      })
  
  
      output$AnalysisOutput &lt;- reactivePlot(function() {
          switch(input$analysis1,
              "Yield curve" = wo(whichOut = 1),
              "Optical asset swap spreads" = wo(whichOut = 2),
              "Cheap dear box" = wo(whichOut = 3),
              "Cheap dear charts" = wo(whichOut = 4),
              "Switch signaliser" = wo(whichOut = 5),
              "Barbells" = wo(whichOut = 6)
          )
  
      })
  
  
  })
  </code></pre>