In ggplot() I can use a named vector (where the values are colors and the names are the respective levels) e.g. in scale_color_manual(values = ... ) and it will correctly draw colors per level no matter in which order the levels appear in the data vs. the named vector. If I understand correctly, this does not apply for col.regions = and col.text = in desplot(). Instead, colors must be provided in the same order as the levels in the data.
Am I correct and do you find it worthwhile implementing this suggestion?
Here is an example where I try using a named vector that is sorted in the wrong order and it leads to a mismatch between colors and levels:
In
ggplot()
I can use a named vector (where the values are colors and the names are the respective levels) e.g. inscale_color_manual(values = ... )
and it will correctly draw colors per level no matter in which order the levels appear in the data vs. the named vector. If I understand correctly, this does not apply forcol.regions =
andcol.text =
indesplot()
. Instead, colors must be provided in the same order as the levels in the data.Am I correct and do you find it worthwhile implementing this suggestion?
Here is an example where I try using a named vector that is sorted in the wrong order and it leads to a mismatch between colors and levels:
Created on 2023-06-13 with reprex v2.0.2