Answers.Body: <p>As @swbarnes2 has suggested, you can plot gene expression over the top of a dimensional reduction using the <code>FeaturePlot</code> function, using the <code>features</code> parameter for gene names:</p>
  <pre><code>p &lt;- FeaturePlot(DG.combined, reduction = &quot;umap&quot;, features = c(&quot;Fos&quot;, &quot;Inhba&quot;))
  </code></pre>
  <p>See the 3k tutorial here:</p>
  <p><a href="https://satijalab.org/seurat/articles/pbmc3k_tutorial.html#cb49" rel="nofollow noreferrer">https://satijalab.org/seurat/articles/pbmc3k_tutorial.html#cb49</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-17T21:09:27.950Z
Answers.LastActivityDate: 2022-02-17T21:09:27.950Z
Answers.UserDisplayName: gringer
Answers.Body: <p>I am not totally sure what you are trying to do, but I think you want FeaturePlot, not DimPlot</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-17T21:04:33.537Z
Answers.LastActivityDate: 2022-02-17T21:04:33.537Z
Answers.UserDisplayName: swbarnes2
Body: <p>I saw in the extensive Seurat documentation for Dimplot (dimensional reduction plot), <a href="https://satijalab.org/seurat/reference/dimplot" rel="nofollow noreferrer">here</a>, you can plot a gene by specifying it with group.by = &quot;gene&quot; but this does not work in practice.</p>
  <pre><code>&gt; p &lt;- DimPlot(DG.combined, reduction = &quot;umap&quot;, group.by = &quot;Fos&quot;)
  Error: Cannot find 'Fos' in this Seurat object
  &gt; p &lt;- DimPlot(DG.combined, reduction = &quot;umap&quot;, group.by = &quot;Inhba&quot;)
  Error: Cannot find 'Inhba' in this Seurat object
  </code></pre>
  <p>Am I mistaken?  Do I need to add a metadata column containing expression of the gene?  How can I access individual cells gene expression data in seurat so I can create a metadata label based on binned expression levels?  Also how would I tell seurat to use a color gradient to label them?</p>
  <p>References
  <a href="https://satijalab.org/seurat/reference/dimplot" rel="nofollow noreferrer">https://satijalab.org/seurat/reference/dimplot</a></p>
  
Tags: <r><rna-seq><scrnaseq><seurat><visualization>
Title: Plotting a gene in Seurat
ThreadText: # Plotting a gene in Seurat
  
  (Asked by: username_0 on 2022-02-17)
  
  I saw in the extensive Seurat documentation for Dimplot (dimensional reduction plot), [here](https://satijalab.org/seurat/reference/dimplot), you can plot a gene by specifying it with group.by = "gene" but this does not work in practice.
  
  ```
  > p <- DimPlot(DG.combined, reduction = "umap", group.by = "Fos")
  Error: Cannot find 'Fos' in this Seurat object
  > p <- DimPlot(DG.combined, reduction = "umap", group.by = "Inhba")
  Error: Cannot find 'Inhba' in this Seurat object
  
  ```
  
  Am I mistaken? Do I need to add a metadata column containing expression of the gene? How can I access individual cells gene expression data in seurat so I can create a metadata label based on binned expression levels? Also how would I tell seurat to use a color gradient to label them?
  
  References
  <https://satijalab.org/seurat/reference/dimplot>
  
  **Tags:** r, rna-seq, scrnaseq, seurat, visualization
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-02-17. Score: 2 | Accepted answer
  
  As @username_2 has suggested, you can plot gene expression over the top of a dimensional reduction using the `FeaturePlot` function, using the `features` parameter for gene names:
  
  ```
  p <- FeaturePlot(DG.combined, reduction = "umap", features = c("Fos", "Inhba"))
  
  ```
  
  See the 3k tutorial here:
  
  <https://satijalab.org/seurat/articles/pbmc3k_tutorial.html#cb49>
  
  
  ---
  
  ### Answer by username_2 on 2022-02-17. Score: 2
  
  I am not totally sure what you are trying to do, but I think you want FeaturePlot, not DimPlot
  
  
  ---
  
  