Workaround for the problem would be to replace NA
values in your data with same other character (for example, unknown
) and plot data.
So, made new variable vore2 that has vore
values as characters. Then replaced NA
values with the unknown
.
msleep$vore2<-as.character(msleep$vore)
msleep$vore2[is.na(msleep$vore2)]<-"unknown"
In the plot used new variable vore2
for the colors.
p <- qplot(sleep_total, sleep_cycle, data=msleep, colour=vore2)
p + scale_colour_hue("What does
it eat?",
breaks=c("herbi", "carni", "omni", "insecti", "unknown"),
labels=c("plants", "meat", "both", "insects", "don't know"))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…