iris
데이터 세트를 사용 :
library(dplyr)
library(ggplot2)
plot_data <- iris %>%
group_by(Species) %>%
summarise_each(funs(mean, sd, n(), q95=quantile(., 0.95), q75=quantile(., 3/4), q25=quantile(., 1/4), q5 = quantile(., 0.05)), Sepal.Length) %>%
mutate(se = sd/sqrt(n),
left95 = mean - 2*se,
right95 = mean + 2*se)
ggplot(plot_data, aes(x = Species, y = mean)) +
geom_crossbar(aes(ymin = q5, ymax = q95), fill = "aquamarine1", color = "aquamarine1", width = 0.2) +
geom_crossbar(aes(ymin = q25, ymax = q75), fill = "aquamarine4", color = "aquamarine4", width = 0.2) +
geom_crossbar(aes(ymin = left95, ymax = right95), fill = "black", color = "black", width = 0.2) +
coord_flip() +
theme_minimal()
이 당신에게 이러한 목표를 달성하기 위해 ggplot2
을 사용하는 방법의 요점을 제공해야합니다. 제공된 데이터는 dplyr
요약없이 쉽게 사용할 수 있습니다.
[재현 가능한 예] (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)를 제공 할 수있는 데이터를 제공해 주실 수 있습니까? –
나는 플롯에 대한 데이터가 [여기]라고 생각합니다 (http://timss2015.org/wp-content/uploads/filebase/science/1.-student-achievement/1_1_science-distribution-of-science-achievement-grade-4. xls) –