df3 <- data_summary(panel_data, varname="invest_amnt",
groupnames=c("trend_id", "path_id"))
df3$path_id=as.factor(df3$path_id)
df3$trend_id=as.factor(df3$trend_id)
head(df3)
df.mean = df3 %>%
group_by(path_id) %>%
mutate(ymean = mean(invest_amnt))
p <- ggplot(df3, aes(x=path_id, y=invest_amnt, fill=trend_id)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin=invest_amnt-sd, ymax=invest_amnt+sd), width=.2,
position=position_dodge(.9))
p + scale_fill_brewer(palette="Paired") + theme_stata() + scale_color_stata()
p + labs(title="",
x="path)", y = "Invested Amount")+ scale_fill_manual(values=c('#f55b5b','#23036b','#e3d613' ))+
theme_classic()+
geom_errorbar(data=df.mean, aes(x =path_id , ymax = ymean, ymin = ymean),
size=1.5, linetype = "longdash", inherit.aes = F, width = 1)