big_theme <- theme(
panel.background=element_rect(fill = "black"),
plot.background =element_rect(fill = "black", colour = NA),
plot.title = element_text(hjust=0.5, size=15, color="white"),
axis.text.y=element_text(colour="white", size=14),
axis.title.x = element_text(colour = "white", size=14),
axis.title.y = element_text(colour = "white", size=14),
axis.text.x=element_text(vjust=1, angle=45, color="white", size=14, hjust=1),
strip.background =element_rect(fill="black"),
strip.text = element_text(colour = 'white'),
strip.text.y = element_text(angle=0),
legend.position = "top"
)
theme2 = theme(panel.background = element_rect(fill = 'black'),
legend.background=element_rect(fill="black"),
legend.text = element_text(colour="white", size=14),
legend.justification = "right",
legend.key.height = unit(1, "line"),
legend.key = element_rect(color="black", fill="black"))
theme3 = theme(plot.background = element_rect(fill = 'black'))
plot1 <- ggplot(sample_data) + big_theme + theme2 + theme3
plot1 + geom_col(aes(x=category, y=value, fill=variable, color=variable)) +
scale_fill_manual(values=c("#000000", "#D3667C", "#53AC79")) +
scale_color_manual(values=c("#00A2EF", "#D3667C", "#53AC79"))
I have a dataset that looks like:
category variable value
a x 1.2
b x 1.05
c x 1.11
a y 1.43
b y 1.09
c y 0.97
a z 1.12
b z 1.46
c z 1.32
I want the order in the ggplot of the bars and legend to be z, x, y. Im trying to use an order variable to do that but it doesn't work when I use order inside my aesthetics. So the bar for a is unfilled and b and c are unfilled.