Seurat: DimPlot legend option not working

Created on 18 Apr 2019  路  1Comment  路  Source: satijalab/seurat

Hi,

With the new DimPlot and UMAPPlot in Seurat v3, it says it can pass further options to CombinePlots, which is where the legend option appears. However, specifying it in DimPlot doesn't seem to do anything.

# nothing happens to legend
p1 <- DimPlot(object = object, reduction = "umap", label = TRUE, legend = "none")
p1
# nothing happens to legend
p2 <- UMAPPlot(object = object, group.by = "orig.ident", label = TRUE, legend = "none")
p2
# legend is now gone
CombinePlots(plots = list(p1, p2), legend = "none")

# works if i do it this way
p1 <- DimPlot(object = px, reduction = "umap", label = TRUE) + ggplot2::theme(legend.position = "none")

Most helpful comment

Hi,

The legend parameter for DimPlot/UMAPPlot is indeed passed to CombinePlots but if only one plot is given to CombinePlots (as is what happens in your first two examples), then it just returns the plot as is. The recommended way to remove the legend if you have only a single plot is as you do it in the last line. We also provide a theme called NoLegend which you could use instead of ggplot2 theme command. E.g.

DimPlot(object = object) + NoLegend()

>All comments

Hi,

The legend parameter for DimPlot/UMAPPlot is indeed passed to CombinePlots but if only one plot is given to CombinePlots (as is what happens in your first two examples), then it just returns the plot as is. The recommended way to remove the legend if you have only a single plot is as you do it in the last line. We also provide a theme called NoLegend which you could use instead of ggplot2 theme command. E.g.

DimPlot(object = object) + NoLegend()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarahwajid picture sarahwajid  路  3Comments

farhanma picture farhanma  路  3Comments

mvalenzuelav picture mvalenzuelav  路  3Comments

igordot picture igordot  路  3Comments

akhst7 picture akhst7  路  3Comments