I have my data like this:
SampleID From To SampleDepth UnitCode Gravel_perc Sand_perc Fines_perc
2007-01 0.00 0.2 0.100 Soil 25 70 4
2007-02 0.20 0.4 0.300 Clay 45 45 5
2007-03 0.40 0.6 0.500 Silt 40 50 5
2007-04 1.12 1.2 1.160 Soil 45 10 40
2007-05 2.31 2.5 2.405 Clay 10 30 50
I want to make a stacked barplot for the UnitCode
with respect to the SampleDepth
using different colours. Example - (0 to 0.2 m -> Soil -> Blue), (0.2 to 0.4 -> Clay -> green), (0.4 to 0.6 -> Silt -> pink) etc. Can anyone please help me in doing this? Also I have provided an image to show what I mean. For different depth intervals ---> different colours to represent the soil type.
Image Example:
Thank You
This should work:
Using this data: