I have the following dataframe:
ML Algorithm Option Coeff Lower Upper
1 Random Forest Algo_1 Opt_1 0.021 -0.124 0.166
2 Lasso Algo_1 Opt_1 0.130 -0.012 0.273
3 XGBoost Algo_1 Opt_1 -0.052 -0.211 0.108
4 Neural Net Algo_1 Opt_1 0.114 -0.009 0.238
5 Random Forest Algo_1 Opt_2 0.116 -0.033 0.264
6 Lasso Algo_1 Opt_2 0.158 0.019 0.297
7 XGBoost Algo_1 Opt_2 -0.260 -0.508 -0.012
8 Neural Net Algo_1 Opt_2 0.035 -0.100 0.170
9 Random Forest Algo_2 Opt_1 0.028 -0.117 0.172
10 Lasso Algo_2 Opt_1 0.134 -0.008 0.277
11 XGBoost Algo_2 Opt_1 -0.054 -0.214 0.106
12 Neural Net Algo_2 Opt_1 0.118 -0.006 0.241
13 Random Forest Algo_2 Opt_2 0.038 -0.097 0.172
14 Lasso Algo_2 Opt_2 0.133 -0.006 0.272
15 XGBoost Algo_2 Opt_2 -0.055 -0.240 0.131
16 Neural Net Algo_2 Opt_2 0.118 -0.007 0.242
The column ML contains four Machine learning algorithms (Random Forest, Lasso, XGBoost, Neural Net). Each ML can be fit with two Algorithms (Algo_1, Algo_2) and each Algo can be fit via two Options (Opt_1, Opt_2) yielding four distinctive coefficients for each ML.
I plot the data the following way:
p <- ggplot(results2, aes(x = Option, y = Coeff, color = ML))+
geom_point(size = 5)+
facet_grid(.~ML+Algorithm,scales = "free_x")+
geom_errorbar(aes(ymin = Lower, ymax = Upper, color = ML), size =1)+
geom_hline(yintercept = 0, color = "grey", size = 1.5) +
scale_x_discrete(guide = guide_axis(n.dodge = 2))+
theme(panel.border = element_blank(),panel.spacing.x = unit(0,"line"))+ # Remove space between facets
xlab("")+
ylab("")
p
Questions: 1.) How do I move the ML name (i.e. Lasso, Random Forest, XGBoost, Neural Net) to the right so that it is above and between the respective Algos, i.e. Algo_1 and Algo_2, so that each ML name only appears once and not twice above each Algo?
2.) How do I make the ML names bold?
Thank you very much for your help.