Hi @Sparkle,
This is a good question! Unfortunately, ensuring this sort of "consistency" isn't currently doable in just the Qurro graphical interface -- although I have opened up an issue to allow for manual recoloring of sample groups similar to what Emperor has.
The current workaround for this is editing the specification in the Vega-Lite language -- you can style your chart however you want to in this language, but learning it can take some time. Here's how you'd make sure the colorscheme is consistent with these boxplots using Vega-Lite.
First off, let's start with the moving pictures tutorial dataset: here I've just selected an arbitrary log-ratio and set the sample boxplot to group samples by BodySite
, but this should generalize to other datasets.
-
Click the circle (with the ...
) at the top-right of the sample plot, then click Open in Vega Editor
.
-
This will open a new tab/window in the Vega-Editor. The pane on the left contains the Vega-Lite specification of this plot, and the pane on the right shows a preview of what this plot looks like.
(Sidenote: you can change the spacing of the plot (e.g. making the boxes less spaced-out) by messing with the "view"
settings at the top of the left pane -- for example, you can set "width"
to 100
instead of 400
.)
-
In the left pane, ctrl-F for "encoding"
. You should see something like:
"encoding": {
... maybe other stuff here ...
"color": {"field": "BodySite", "type": "nominal"},
... maybe other stuff here ...
}
(For your plots, instead of BodySite
you should see Replicate
-- this is just the field by which your samples are grouped in the boxplot.)
-
The "color"
section is the important thing here. To set a specific color for each sample group, you'll need to add on a "scale"
section here. Here is an example of doing this for the q2-moving-pictures boxplot:
"encoding": {
... maybe other stuff here ...
"color": {
"field": "BodySite",
"type": "nominal",
"scale": {
"domain": ["gut", "left palm", "right palm", "tongue"],
"range": ["#000", "#f00", "#0f0", "#00f"]
}
},
... maybe other stuff here ...
}
And the resulting plot:
These colors are kind of ugly :), but hopefully you get the idea. The main thing to notice is the 4 lines starting with "scale"
-- here, you can manually set the color for each sample group (the group names are in domain
, and the actual colors are in range
). Here I've used Hex triplet notation to set colors, but I think you can also use basic color names (e.g. red
) if you want. (sidenote:
if you want to use the exact same colors as in the default categorical color scheme (tableau10
), it's just a matter of picking the exact colors to use -- I think this link has the hex colors for tableau10.)
Once you're satisfied with these colors, you can just copy-paste that block into the Vega-Lite spec for other boxplots. The same colors should be used across sample groups, even if some sample groups are missing:
(this is the log-ratio of variabile
to Bacteroides
-- I just tried to pick a log-ratio that purposefully doesn't cover all samples.)
One side effect is that all samples are included in the color legend (so in the above figure, left palm
and tongue
still show up in the legend). I don't know of a good way around this besides manually removing stuff from the scale
, sorry -- but of course you could always just crop this out if you're showing multiple boxplots with the same colorscheme side-by-side in a paper.
Anyway! Sorry for the long post, but hopefully this all helps.