:
geom_point ( ), shape level, geom_hline.
geom_point(aes(shape = "int"), alpha = 0)
:
ggplot / aes. , colour shape , .
, "x", "y" "grp" :
df <- data.frame(x = rep(1:2, 2), y = 1:4, grp = rep(c("a", "b"), each = 2))
color, shape 'grp'
ggplot(data = df, aes(x = x, y = y, color = grp, shape = grp)) +
geom_line() +
geom_point(size = 4)

, aes, color shape .
a geom_hline. , geom_line . , color , .. color aes geom_hline. , . , .
ggplot(data = df, aes(x = x, y = y, color = grp, shape = grp)) +
geom_line() +
geom_point(size = 4) +
geom_hline(aes(yintercept = 2.5, color = "int"))

: color aes geom_line geom_hline, shape geom_point s. , "", color, : "grp" "int", geom_hline aes. , color shape, ggplot .
?
, shape, color, geom_point (alpha= 0), aes :
ggplot(data = df, aes(x = x, y = y, color = grp, shape = grp)) +
geom_line() +
geom_point(size = 4) +
geom_hline(aes(yintercept = 2.5, color = "int")) +
geom_point(aes(shape = "int"), alpha = 0)

, factor "geom_hline" . drop = FALSE scale_shape_discrete, " ":
datadf$grp <- factor(df$grp, levels = c(unique(df$grp), "int"))
ggplot(data = df, aes(x = x, y = y, color = grp, shape = grp)) +
geom_line() +
geom_point(size = 4) +
geom_hline(aes(yintercept = 2.5, color = "int")) +
scale_shape_discrete(drop = FALSE)
, , guides "override" shape aes geom_hline, NA:
guides(colour = guide_legend(override.aes = list(shape = c(16, 17, NA))))