Answers.Body: <p>The title is misleading as this error doesn't have anything to do with making the font italic. In Seurat v2, FeaturePlot does not return a ggplot2 object by default, so <code>p</code> in your case is <code>NULL</code>. You need to set <code>do.return</code> to <code>TRUE</code> in the FeaturePlot call.</p>
  
  <p>You should instead do:</p>
  
  <pre><code>library(Seurat)
  
  p &lt;- FeaturePlot(pbmc_small, head(pbmc_small@var.genes), do.return = TRUE)
  
  for(i in 1:length(p)) {
    p[[i]] &lt;- p[[i]] + theme(plot.title = element_text(face = 'italic'))
  }
  
  cowplot::plot_grid(plotlist = p)
  </code></pre>
  
  <p><a href="https://i.sstatic.net/h9me4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/h9me4.png" alt="featureplot"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-10T18:42:59.803Z
Answers.LastActivityDate: 2019-01-10T18:42:59.803Z
Answers.UserDisplayName: TimStuart
Body: <p>I have got the problem on how to write the italic script in RStudio. I used the script in the screenshot and got the error "Error in grobs[[i]]: subscript out of bounds." <a href="https://i.sstatic.net/emCgW.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/emCgW.jpg" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-10T18:14:44.737Z
Comments.Text: Please replace the image with the actual text.
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-10T18:20:04.303Z
Comments.Text: Have you ensured that all of the elements of `p` are grobs (things plottable by ggplot)? The error suggests that that's not that case, so try just iterating over `1:4` instead.
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-10T19:51:38.253Z
Comments.Text: Seriously. It's even *easier* to paste the text!
Comments.UserDisplayName: Daniel Standage
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-10T20:31:02.780Z
Comments.Text: I'm voting to close this question as off-topic because formatting text as italics is not a bioinformatics problem
Comments.UserDisplayName: Bioathlete
Tags: <rna-seq><single-cell>
Title: how to write italic script in Rstudio
ThreadText: # how to write italic script in Rstudio
  
  (Asked by: username_0 on 2019-01-10)
  
  I have got the problem on how to write the italic script in RStudio. I used the script in the screenshot and got the error "Error in grobs[[i]]: subscript out of bounds." [![enter image description here](https://i.sstatic.net/emCgW.jpg)](https://i.sstatic.net/emCgW.jpg)
  
  **Tags:** rna-seq, single-cell
  
  > **Comments:**
  > **username_1**: Please replace the image with the actual text.  
  > **username_1**: Have you ensured that all of the elements of `p` are grobs (things plottable by ggplot)? The error suggests that that's not that case, so try just iterating over `1:4` instead.  
  > **username_2**: Seriously. It's even *easier* to paste the text!  
  > **username_3**: I'm voting to close this question as off-topic because formatting text as italics is not a bioinformatics problem  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2019-01-10. Score: 4 | Accepted answer
  
  The title is misleading as this error doesn't have anything to do with making the font italic. In Seurat v2, FeaturePlot does not return a ggplot2 object by default, so `p` in your case is `NULL`. You need to set `do.return` to `TRUE` in the FeaturePlot call.
  
  You should instead do:
  
  ```
  library(Seurat)
  
  p <- FeaturePlot(pbmc_small, head(pbmc_small@var.genes), do.return = TRUE)
  
  for(i in 1:length(p)) {
    p[[i]] <- p[[i]] + theme(plot.title = element_text(face = 'italic'))
  }
  
  cowplot::plot_grid(plotlist = p)
  
  ```
  
  [![featureplot](https://i.sstatic.net/h9me4.png)](https://i.sstatic.net/h9me4.png)
  
  
  ---
  
  