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")
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()
Most helpful comment
Hi,
The
legendparameter forDimPlot/UMAPPlotis indeed passed toCombinePlotsbut if only one plot is given toCombinePlots(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 calledNoLegendwhich you could use instead of ggplot2 theme command. E.g.