1. barchart
x축 변수 1개로만 그리는 경우
xxxxxxxxxx
ggplot(Group_Data) +
geom_bar(aes(x = as.factor(Counts),fill = ..count..)) +
xlab("") + ylab("") +
scale_fill_gradient(low = "#CCE5FF", high = "#FF00FF") +
theme_classic() + ggtitle("Continuous Color")
ggplot(Group_Data) +
geom_bar(aes(x = as.factor(Counts),fill = Day),alpha = 0.4) +
xlab("") + ylab("") +
theme_classic() + ggtitle("Discrete Color")
ggplot(Group_Data) +
geom_bar(aes(x = as.factor(Counts),fill = Day),
alpha = 0.4,position = "dodge") +
xlab("") + ylab("") +
theme_classic() + ggtitle("Discrete Color\n position Dodge")
x축, y축 변수 2개로 그리는 경우, stat = 'identity' 사용합니다.
xxxxxxxxxx
ggplot(Group_Data) +
geom_bar(aes(x = Year, y = Mean, fill = Day), stat = 'identity') +
scale_fill_manual(values = c("#C2DAEF","#C2EFDD","#BBAAE9",
"#E9F298","#FABDB3")) +
theme_classic()
ggplot(Group_Data) +
geom_bar(aes(x = Year, y = Mean, fill = Day), stat = 'identity') +
scale_fill_manual(values = c("#C2DAEF","#C2EFDD","#BBAAE9",
"#E9F298","#FABDB3")) +
theme_classic() +
facet_wrap(~Day)
댓글
댓글 쓰기