0
ggplot을 사용하여 그룹화 된 상자 그림을 플로트하려합니다.ggplot의 boxplot이 예기치 않은 결과를 출력합니다.
샘플 (10 행)를 참조하시기 바랍니다 내 데이터에서 : 아래 그림처럼 뭔가
library(ggplot2)
library(ggthemes)
ggplot(data, aes(x= colsample_bytree, y = best_F1, fill = as.factor(alpha))) +
geom_boxplot(alpha = 0.5, position=position_dodge(1)) + theme_economist() +
ggtitle("F1 for alpha and colsample_bytree")
이것은 생산 :
alpha colsample_bytree best_F1
35 0.00 0.5 0.5825656
78 0.10 0.3 0.4716612
68 0.00 0.3 0.4714286
27 0.40 1.0 0.4786216
49 0.15 0.5 0.4943968
62 0.00 0.3 0.4938805
70 0.00 0.3 0.4849785
73 0.10 0.3 0.4997061
59 0.30 0.5 0.4856369
88 0.20 0.3 0.4552402
sort(unique(data$alpha))
0 0.1 0.15 0.2 0.3 0.4
sort(unique(data$colsample_bytree))
0.3 0.5 1
내 코드는 다음과 같다 다음 도표 :
다음 경고 :Warning message:
"position_dodge requires non-overlapping x intervals"
가변 colsample_bytree 3 개 이산 값을 취하고 I가 그룹에 대응하는 6 개 상자 그림에서 이루어지는 --each 상자 그림 3 개 그룹을 기대할 것이다 가변 알파 6 걸리므 colsample_bytree의 다른 값에 위치하는 다른 알파 값 및 각 그룹, 즉 0.3, 0.5 및 1
내가 인용 한 예와 같이 boxplots이 겹치지 않을 것으로 예상됩니다.
상단의 예는 범주 형 x 축을 사용합니다 – Axeman