Adding legend to somalier PCA plots

Hi there! Thanks for the wonderful tool. I am running MultiQC on somalier output and it seems the PCA plot does not have a legend. Is this normal? Here is an example figure

Hi @aarthi-mohan,

So the short answer is that yes, this is normal. MultiQC typically doesn’t do legends for scatter plots because it typically works on a per-sample (as in, per-point) basis. So a legend would here would include thousands of sample names and be unusable.

This scatter plot is a bit special because colours are used on groups of points, which is not all that common in MultiQC. There isn’t any standard interface to create a legend for scatter plots in this case. You can see one of the other Somalier plots gets around this by including a legend in the description text:

Being able to create custom legends for these cases would certainly be an interesting feature though. I’ve added an issue for this here:

Phil

Ah I see, thanks for explaining this and creating an issue on this. It would certainly be helpful.
Fyi, I have a html produced by somalier (v 0.2.18) with plots for PCA similar to MultiQC, but it has the group legends using Plotly I guess, here is the screenshot from somalier.

Yeah, I created the MultiQC version based on the original Somalier output. That’s why they look similar.