I have a set of coefficient estimates, and their standard errors from the R package BMA
. I would like to produce a figure showing their value, with error bars. I've been able to make the plot, but have not been able to change the legend.
My code is:
ggplot(res.BMA[-c(1,8),], aes(x = Beta, y = EV)) +
geom_errorbar(aes(ymin = EV-SD, ymax = EV+SD), width = 0.1) +
geom_point(aes(size = Psize)) +
facet_wrap(~Year) +
xlab("Parameter") +
ylab("Estimated Value") +
scale_fill_discrete(name = "P!=0", labels = c("0-20", "20-40", "40-60", "60-80", ">80"))
I'd like the legend title to be "P!=0" rather than Psize (any guidance on changing != to not equals [\u2260]
would be appreciated as well), and the labels to be "0-20", "20-40", "40-60", "60-80", "80-100" rather than 1,2,3,4,5.
Eventually, this will be plotted in a custom theme, based on theme_bw
, to clean up the axes, etc. Any guidance would be appreciated!
Data:
Year Beta P Psize EV SD
1 1978 Intercept 100.0 5 -2.278802 0.10678
2 1978 Homestead Density (250m) 89.1 5 0.245324 0.13542
3 1978 Structure Density (1000m) 17.8 1 -0.009627 0.06958
4 1978 %Edge forest (250m) 38.2 2 0.078142 0.14320
5 1978 %Core forest (2000m) 50.6 3 -0.116838 0.15194
6 1978 Mean NDVI 16.1 1 -0.006095 0.04509
7 1978 Homestead Density × %Edge forest 24.0 2 -0.027491 0.17412
8 2001 Intercept 100.0 5 -2.096206 0.10638
9 2001 Homestead Density (250m) 40.2 3 0.067039 0.10918
10 2001 Structure Density (1000m) 57.1 3 0.204915 0.21991
11 2001 %Edge forest (250m) 31.5 2 0.044161 0.09353
12 2001 %Core forest (2000m) 57.7 3 -0.208547 0.22165
13 2001 Mean NDVI 17.6 1 -0.001539 0.04867
14 2001 Homestead Density × %Edge forest 19.3 1 0.008105 0.07373