# Add gene SYMBOL to your plots

**URL:** <https://help.c-moor.org/t/add-gene-symbol-to-your-plots/155>\
**Category:** Code Cookbook\
**Created:** [February 18, 2022, 10:17pm UTC](https://help.c-moor.org/t/add-gene-symbol-to-your-plots/155 "2022-02-18T22:17:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LindsayHayes](https://yyz1.discourse-cdn.com/flex027/user_avatar/help.c-moor.org/lindsayhayes/32/14_2.png) [@LindsayHayes](https://help.c-moor.org/u/LindsayHayes)\
**Post date:** [February 18, 2022, 10:17pm UTC](https://help.c-moor.org/t/add-gene-symbol-to-your-plots/155/1 "2022-02-18T22:17:16Z")

</div>

Did you just plot a bunch of genes using the ENSEMBL ID and now you can’t tell which gene SYMBOL belongs to each plot? 🤨  
Solution: Add the gene **SYMBOL** directly to the plot!

Here is how to do it:

```auto
gene_name <- "Sox17"
gene_id <- rowData(sce)[which(rowData(sce)[,2] %in% gene_name),1]
plotReducedDim(object = sce, dimred="umap", colour_by=gene_id) + labs(title = gene_name)
plotExpression(object = sce, features = gene_id, x = "celltype") + labs(title = gene_name)

```

Here is why it works!

1. assign your gene of interest (here Sox17) to the object `gene_name`

```auto
gene_name <- "Sox17"

```

1. convert the gene name to the ENSEMBL gene id for plotting and call it `gene_id`

```auto
gene_id <- rowData(sce)[which(rowData(sce)[,2] %in% gene_name),1]

```

1. add the `gene_id ` to the plotting function (`plotReducedDim`) instead of the ENSEMBL ID
2. Add the `gene_name` directly to the plot using `+ labs(title = gene_name)`

```auto
plotReducedDim(object = sce, dimred="umap", colour_by=gene_id) + labs(title = gene_name)

```

This is really convenient because all you have to do is change the `"Sox17"` to see a different gene without having to change any of the other codes! Whew… 🫡
