I have a data set that looks like this:
samp.data <- structure(list(Track = c(1,1,1,1,1,1,1,1,2,2,2),
Base = c("A","C","B","A","D","D","C","A","A","B","B"),
Length = c(1,1,1,1,2,3,1,1,1,1,1)),
.Names = c("Track", "Base", "Length"), class = "data.frame",row.names = c(NA, 11L))
# Track Base Length
# 1 1 A 1
# 2 1 C 1
# 3 1 B 1
# 4 1 A 1
# 5 1 D 2
# 6 1 D 3
# 7 1 C 1
# 8 1 A 1
# 9 2 A 1
# 10 2 B 1
# 11 2 B 1
I am trying to plot an unordered stacked bar, with Tracks on the x axis and Length on the y axis. In other words, the bar graph wouldn't group the A bases together and plot it as one length of 1+1+1+1=4. It would plot each base in order. First it would plot the A base of length 1 in Track 1, C base of length 1 above that, B base of length 1 above that, A base of length 1 above that, D base of length 2 above that, and so on.
Below is a crude ASCII diagram of what I am trying to describe:
| C
L | Y
e | Y Key
n | R A = Red
g | B B B = Blue
t | B G C = Green
h | R R D = Yellow
----------
2 1
Track
Sorry if the explanation is a little confusing. Thank you for your help!
Edit: This question is different from the possible duplicate, because I would like to ungroup the stacked sections.