Hello, I have the following sample dataset.
sex <- as.factor(c(rep(0,12),rep(1,12)))
char <- c("x","x","x","x","y","y","y","y","z","z","z","z","x","x","x","x","y","y","y","y","z","z","z","z")
a <- runif(24,0,2)
b <- runif(24,4,10)
data <- data.frame(cbind(sex,char,a,b))
I would like to generate a blak and white plot with two groups of three smooth lines. linetypes are recognized by sex, and each line with dots, squares and triangles according to the group of char. the following is one group, i need to plot two, one type is solid, the other type is dotted. how to do it?
I tried a color plot with the following code. what should i change "color" to?
pb <- ggplot(data, aes(x = a, y = b,
color = char, linetype = factor(sex)))
p0 <- pb +
scale_color_manual(values = c("#00FFFF", "#FFFF00", "#00FF00")) +
scale_linetype_manual(breaks=c("0","1"), values=c(1,2), labels = c("male", "female")) +
geom_smooth(method = "lm",
se = FALSE, # Don't add shaded confidence region
size = 1.2, aes(group = char : sex))
Thanks a looooot!
