I wanted to create a stacked bar chart with the colors I've indicated in the color_vector. But it's still printing out the default colors associated with ggplot2.
#create a stacked barchart of proportion
color_vector <- c("lightcoral", "lightblue1", "lightgoldenrod", "salmon", "peachpuff", "pink2", "tan1", "sienna1", "slategray1", "indianred1", "black")
names(color_vector) <- levels(merged_df$trstprl)
ggplot(merged_df, aes(y=proportion, x=cntry, fill = rev(as.factor(trstprl)))) +
geom_bar(position="stack", stat="identity") +
scale_color_manual(name = "trust level", values = color_vector) +
ylab("% of each ranking for trust level") +
xlab("country") +
guides(fill=guide_legend(title="Levels of Trust")) +
scale_fill_discrete(labels=c('10 = Maximum Trust', '9', '8', '7', '6', '5', '4', '3', '2', '1','0 = No Trust')) +
ggtitle("Proportion of Trust for Government by Country") +
theme_stata() +
theme(legend.position = "top", legend.title=element_text(size=10))
I've tried using the scale_color_manual but that doesn't seem to be doing anything. I've also tried changing fill to color = rev(as.factor(trstprl))
but that just changes the color of the outline not the entire area of the barchart i'm trying to change