# ggplot color palette 사용
# scale_colour_brewer(palette='palette_name')
mpg %>% ggplot(aes(x = cty, y = hwy)) +
geom_point(aes(color = factor(class))) +
scale_colour_brewer(palette="Paired")

# palette 역순으로 사용 시
# scale_colour_brewer(palette="palette_name", direction = -1)
mpg %>% ggplot(aes(x = cty, y = hwy)) +
geom_point(aes(color = factor(class))) +
scale_colour_brewer(palette="Paired", direction = -1)


'R' 카테고리의 다른 글
[R] ggplot density chart (1) | 2021.09.01 |
---|---|
[R] correlation (0) | 2021.08.31 |
[R package] lubridate (0) | 2021.08.24 |
[R] category 형 변수 Label encoding (0) | 2021.08.24 |
[R] data.frame을 클립보드 복사 (0) | 2021.08.23 |