how to plot with color according to factor keeping a fixed number of levels?
On Sun, 31 Jul 2022 15:26:14 +0200
Luigi Marongiu <marongiu.luigi at gmail.com> wrote:
but since there is no Y==0, the colors are shifted because Z has only two levels.
You're almost there: you're already making Z a factor. Use factor(Z, levels = c(-1, 0, 1)) to make a factor with a predefined range of values.
Best regards, Ivan