I have the following data frame: the point estimates (beta_), the lower bound of the CI (lowerci_), and the upper bound (upperci_). I want to plot the estimates as points and an area without lines, just shading (and transparency, alpha), meaning the CI. But my code is not working even though it seems to work for people online.
data <- read_csv("round,beta_,lowerci_,upperci_,panel_round
0,-6.559555121299354e-10,-5.44198064389434e-9,4.130069619634469e-9,BL
1,0.029400043189525604,-0.21591313183307648,0.2747132182121277,HF01
2,-0.05057445541024208,-0.30436697602272034,0.20321807265281677,HF02
3,0.05245266854763031,-0.1334749162197113,0.23838025331497192,HF03
4,0.005192806478589773,-0.11910264194011688,0.1294882595539093,HF04
5,-0.017897112295031548,-0.21049267053604126,0.17469844222068787,HF05
6,-0.015306402929127216,-0.1945999711751938,0.1639871746301651,HF06
7,-0.058936167508363724,-0.22124320268630981,0.10337086021900177,HF07
8,-0.06648150831460953,-0.2282124012708664,0.09524938464164734,HF08
9,0.02168324775993824,-0.1671695113182068,0.21053601801395416,HF09
10,-0.04629828408360481,-0.1798108071088791,0.08721423894166946,HF10
14,0.03215331211686134,-0.12467528879642487,0.18898190557956696,END")
ggplot(aes(panel_round, beta_)) +
geom_hline(yintercept = 0, linetype = "solid", color = "black") +
geom_point(size = 5) +
geom_ribbon(aes(ymin = lowerci_, ymax = upperci_)) +
labs(x = "",
y = "Impact on Food Insecurity Experience Scale (reversed)") +
theme_minimal(base_size = 15) +
theme(panel.background = element_rect(fill = "white", colour = "white"), # set panel background to white
plot.background = element_rect(fill = "white", colour = "white") # set plot background to white (optional)
)
)