Answers.Body: <p>I tried with some data that I have and this is working for me: </p>
  
  <pre><code>p &lt;- FeaturePlot(object = seurat_object, features.plot = id, cols.use = c("grey", "blue"),
                        reduction.use = "tsne", do.return = TRUE)
  
  
  lapply(p, function(x){x + labs(title = endothelial_symbols[1])})
  </code></pre>
  
  <p>I think it is because FeaturePlot returns several ggplot objects according to the ids you put. This is returned as a list of plots so you have to iterate each one for labeling. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-13T12:49:10.837Z
Answers.Text: This can be “simplified” to ``lapply(p, `+`, labs(title = endothelial_symbols[1]))``.
Answers.UserDisplayName: Konrad Rudolph
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-02T07:58:14.953Z
Answers.LastActivityDate: 2018-05-02T07:58:14.953Z
Answers.UserDisplayName: jxx_fa
Body: <p><code>FeaturePlot</code> is a function in <a href="http://satijalab.org/seurat/pbmc3k_tutorial.html" rel="noreferrer">Seurat</a> package.</p>
  
  <p>And in the vignette it is written that if we specify parameter <code>do.return = TRUE</code> it should return ggplot2 object. It is not working. My goal here is just to change the title of the plot. In case of violin plot I can do the following:</p>
  
  <pre><code>VlnPlot(object = seurat_object, features.plot = id, do.return = TRUE) + labs(title = endothelial_symbols[1])
  </code></pre>
  
  <p>But with <code>FeaturePlot</code> similar code fails to work:</p>
  
  <pre><code>FeaturePlot(object = seurat_object, features.plot = id, cols.use = c("grey", "blue"),
                            reduction.use = "tsne", do.return = TRUE) + labs(title = endothelial_symbols[1])
  </code></pre>
  
  <p>Giving the error:</p>
  
  <blockquote>
    <p>Error in FeaturePlot(object = seurat_object, features.plot = id, cols.use = c("grey",  : 
      non-numeric argument to binary operator</p>
  </blockquote>
  
  <p>Any suggestions would be greatly appreciated.</p>
  
Tags: <r><ggplot2><seurat>
Title: FeaturePlot from Seurat: change its title
ThreadText: # FeaturePlot from Seurat: change its title
  
  (Asked by: username_0 on 2018-05-01)
  
  `FeaturePlot` is a function in [Seurat](http://satijalab.org/seurat/pbmc3k_tutorial.html) package.
  
  And in the vignette it is written that if we specify parameter `do.return = TRUE` it should return ggplot2 object. It is not working. My goal here is just to change the title of the plot. In case of violin plot I can do the following:
  
  ```
  VlnPlot(object = seurat_object, features.plot = id, do.return = TRUE) + labs(title = endothelial_symbols[1])
  
  ```
  
  But with `FeaturePlot` similar code fails to work:
  
  ```
  FeaturePlot(object = seurat_object, features.plot = id, cols.use = c("grey", "blue"),
                            reduction.use = "tsne", do.return = TRUE) + labs(title = endothelial_symbols[1])
  
  ```
  
  Giving the error:
  
  > Error in FeaturePlot(object = seurat\_object, features.plot = id, cols.use = c("grey", :
  > non-numeric argument to binary operator
  
  Any suggestions would be greatly appreciated.
  
  **Tags:** r, ggplot2, seurat
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-02. Score: 3 | Accepted answer
  
  I tried with some data that I have and this is working for me:
  
  ```
  p <- FeaturePlot(object = seurat_object, features.plot = id, cols.use = c("grey", "blue"),
                        reduction.use = "tsne", do.return = TRUE)
  
  lapply(p, function(x){x + labs(title = endothelial_symbols[1])})
  
  ```
  
  I think it is because FeaturePlot returns several ggplot objects according to the ids you put. This is returned as a list of plots so you have to iterate each one for labeling.
  
  > **Comments:**
  > **username_2**: This can be “simplified” to ``lapply(p, `+`, labs(title = endothelial_symbols[1]))``.  
  
  ---
  
  