title: How to modify the plot sizes in shiny app?
body: <p>I built a shiny app which present several plot types. However, the plots are cut from the top, and they are too wide. I tried modifying the width and height in the <code>plotOutput</code> function, did not work.</p>
  <h4>My code:</h4>
  <pre><code>ui &lt;- fluidPage(theme = shinytheme('united'),
    titlePanel(title = h3(&quot;Graphs - ordered chronologically&quot;, align=&quot;center&quot;)),
    selectInput(&quot;Plot&quot;, 
                &quot;Choose what plots to present&quot;, 
                choices = list(Heatmap = &quot;Heatmap&quot;, PCA = &quot;PCA&quot;, VolcanoPlot = &quot;VolcanoPlot&quot;, GSEA = 'GSEA')),
    submitButton(text = &quot;Show plots&quot;),
    verticalLayout( plotOutput(outputId = &quot;PART.1&quot;, width = '70%'))
  )
  </code></pre>
  <p>The problem is most prominent with the Heatmaps and Volcano plots. The volcano plot is cut from the top, and the heatmaps are too stretched wide:</p>
  <p><a href="https://i.stack.imgur.com/KJsno.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KJsno.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/ZlBFL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZlBFL.png" alt="enter image description here" /></a></p>
  <p>How can I fix this? thank you.</p>
  <h3>EDIT:</h3>
  <p>A minimal version of my code:</p>
  <pre><code>    library(data.table)
      library(dplyr)
      library(shiny)
      library(shinythemes)
      library(plotly)
      library(compGenomRData)
      library(BiocManager)
      library(DESeq2)
      library(org.Hs.eg.db)
      library(TxDb.Hsapiens.UCSC.hg19.knownGene)
      library(EnsDb.Hsapiens.v86)
      library(AnnotationHub)
      library(AnnotationDbi)
      library(pheatmap)
      library(EnhancedVolcano)
      library(ggplot2)
      library(FactoMineR)
      library(devtools)
      library(clusterProfiler)
      library(ggnewscale)
      library(enrichplot)
      library(msigdbr)
      library(readxl)
        library(ExperimentHub)
      library(annotate)
  
      ui &lt;- fluidPage(theme = shinytheme('united'),
        titlePanel(title = h3(&quot;Graphs - ordered chronologically&quot;, align=&quot;center&quot;)),
        selectInput(&quot;Plot&quot;, 
                    &quot;Choose which plots to present&quot;, 
                    choices = list(Heatmap = &quot;Heatmap&quot;, PCA = &quot;PCA&quot;, VolcanoPlot = &quot;VolcanoPlot&quot;, GSEA = 'GSEA')),
        submitButton(text = &quot;Show plots&quot;),
        verticalLayout( plotOutput(outputId = &quot;PART.1&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.2&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.3&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.4&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.5&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.6&quot;, width = '70%'),
        plotOutput(outputId = &quot;PART.7&quot;, width = '70%'))
      )
      
      server &lt;- function(input, output) {
  
  
        # RNA-seq data
        raw_counts &lt;- frea
      d('E-MTAB-7805-raw-counts.tsv', data.table = F) 
        metadata &lt;- fread('E-MTAB-7805-experiment-design.tsv' ,data.table = F)
        
        
        A=duplicated(raw_counts$`Gene ID`) # Check for duplicates and remove them
        raw_counts = raw_counts[!A,]
        A=duplicated(raw_counts$`Gene Name`) # Check for duplicates and remove them
        raw_counts = raw_counts[!A,]
    
        
        Hugo.Symbol &lt;- raw_counts[,c(1:2)]
        rownames(raw_counts) &lt;- raw_counts$`Gene Name` # renaming rownames
        raw_counts &lt;- raw_counts[, -c(1:2)]
        
        # metadata
        C = duplicated(metadata$Run) # Check for duplicates and remove them
        metadata = metadata[!C,]
        
        rownames(metadata) &lt;- metadata$Run
        metadata &lt;- metadata[,-1]
        
        ind &lt;- order(colnames(raw_counts), rownames(metadata))
        raw_counts &lt;- raw_counts[,ind]
  
         
    # filter
    target1 &lt;- c(&quot;0 day&quot;, &quot;1 day&quot;)
    Meta_filter1 &lt;- metadata %&gt;% dplyr::filter(`Factor Value[time]` %in%  target1)
    Counts_filter1 &lt;- raw_counts[intersect(names(raw_counts), rownames(Meta_filter1))]
    rownames(Counts_filter1) &lt;- Hugo.Symbol$`Gene Name`
    
    
    
    # annotate
    Meta_filter1$group &lt;- plyr::mapvalues(Meta_filter1$`Factor Value[time]`, c(&quot;0 day&quot;, &quot;1 day&quot;),
                                          c(&quot;CTRL&quot;, &quot;CASE&quot;))
    ind &lt;- order(colnames(Counts_filter1), rownames(Meta_filter1))
    Counts_filter1 &lt;- Counts_filter1[,ind]
  
  
        dds &lt;- DESeqDataSetFromMatrix(countData =  Counts_filter1,
                                       colData =  Meta_filter1,
                                       design = ~ group)
        
        dds = DESeq(dds)
        
        res = results(dds)
        res$symbol &lt;- rownames(res)
        resOrder &lt;- res[order(res$padj),]
        
        
        # heatmap
        dds.symbol = dds
        rownames(dds.symbol) = mapIds(org.Hs.eg.db,
                                      keys=rownames(dds),
                                      column=&quot;SYMBOL&quot;,
                                      keytype=&quot;SYMBOL&quot;,
                                      multiVals=&quot;first&quot;)
        rownames(dds.symbol)[is.na(rownames(dds.symbol))] = rownames(dds)[is.na(rownames(dds.symbol))]
        rownames(dds.symbol) = make.unique(rownames(dds.symbol))
        
        selectUp &lt;- resOrder$symbol[resOrder$log2FoldChange&gt;0][1:20]
        selectDown &lt;- resOrder$symbol[resOrder$log2FoldChange&lt;0][1:20]
        select = c(selectUp,selectDown)
        df &lt;- data.frame(row.names = colnames(dds.symbol),
                         group = colData(dds.symbol)$group)
        
        normcounts = assay(vst(dds.symbol,blind=T, nsub = 2000))
        
        
        # Functional enrichment
        res = res[!is.na(res1$padj),]
        mygenes &lt;- rownames(res)
        
        lfc = res1$log2FoldChange # get gene symbol
        names(lfc) &lt;- rownames(res) 
        lfc &lt;- sort(lfc, decreasing = TRUE)
        
        hallmarks &lt;- msigdbr(species = &quot;Homo sapiens&quot;, category = &quot;H&quot;) %&gt;% 
          dplyr::select(gs_name, gene_symbol)
      
      ## Output 
        
        output$PART.1 &lt;- renderPlot({
          if (input$Plot == 'Heatmap') { 
            
            pheatmap(normcounts[select,], cluster_rows=TRUE,
                           show_colnames = FALSE,cluster_cols=TRUE, 
                           annotation_col=df, scale = 'row',cutree_cols = 2,cutree_rows = 2)
            
            
            
          } else if (input$Plot == 'PCA') {
            Var &lt;- apply(normcounts, 1, var)
            selectedVarGenes &lt;- names(Var[order(Var, decreasing = T)][1:1000])
            M &lt;- t(normcounts[selectedVarGenes,])
            pcaResults = prcomp(M)
            qplot(pcaResults$x[,1],pcaResults$x[,2], col=dds1$group,size=2)
      
            
            
          } else if (input$Plot == 'VolcanoPlot') {
            
      
            EnhancedVolcano(resOrder,
                            lab = resOrder$symbol,
                            x = 'log2FoldChange',
                            y = 'padj',
                            labSize=4,
                            FCcutoff=2 )
       
            
            
          } else  {
            em &lt;- GSEA(lfc, TERM2GENE = hallmarks)
            dotplot(em)
            
            
          }
          
        })
        
      shinyApp(ui = ui, server = server)
  </code></pre>