I have a colour data frame that I join with my input data to match the colours to categories. The issue is that when using fill=mycolour
the legend displays the colour names and not the names of my categories.
I would like fill to be name_assigned
while still matching the colours in mycolors
.
df %>%
dplyr::left_join(colors.variable, by="name_assigned") %>%
ggplot(aes(reorder(chr,chr,function(x)-length(x)),y=name_assigned, fill=mycolors)) +
geom_bar(aes(y = (..count..))) +
scale_fill_identity()