I have a data frame D
that look like this:
Track <- c(0,0,0,-1,1,1)
Length <- c(1,1,2,1,3,1)
Legend <- c("A","B","A","C","B","C")
D <- data.frame(Track,Length,Legend)
D
# Track Length Legend
# 0 1 A
# 0 1 B
# 0 2 A
# -1 1 C
# 1 3 B
# 1 1 C
I am currently using this code to plot it:
ggplot(Z, aes(x=Track, y=Length, fill=Legend)) +
geom_bar(stat='identity') + geom_point() + expand_limits(x=0,y=0) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))
And the graph looks like this:
However I want to assign the color white to variable B. Is this manipulation possible? Additionally I am using dummy data for simplicity's sake in this post. The actual data that I will be using may have 10 or more different variables under Legend, so writing out each hex color doesn't look like a clean option.
Thank you for the help