Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df = data.frame("x" = rnorm(6),
- "y" = rnorm(6),
- "class" = letters[1:6] %>% toupper)
- colors = c("#FF0000", "#0000FF")
- shapes = c(16, 17, 18)
- class_form = expand.grid("color" = colors,
- "shape" = shapes)
- rownames(class_form) = letters[1:6] %>% toupper
- print(class_form)
- gg = ggplot(data = df,
- mapping = aes(x = x,
- y = y,
- fill = class,
- color = class,
- shape = class))
- gg = gg + geom_point()
- gg = gg + scale_fill_manual (values = class_form[, "color"])
- gg = gg + scale_color_manual(values = class_form[, "color"])
- gg = gg + scale_shape_manual(values = class_form[, "shape"])
- gg %>% print
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement