Yes, the order of the color depends on levels(factor)
, and yes, you can use levels(factor)
for your legend text.
This applies everytime you are dealing with a factor. There is also a number of functions for you to manipulate the levels of your factor if you need so, e.g. check ?relevel
.