I have this data file:
A
    169
    164
    164
    102
    150
    100
    145
B
    145
    107
    115
    120
    140
I want to create a stacked histogram out of it. I'd like to set a range (let's say 100 to 170), set bin width (let's say 10) for X axis and that it will count how much it has in each bin (for example 140 to 149 would have 1 in A and 2 in B) and plot the count in Y axis using bars. The coloring (or hatching or whatever) would be different for the A count and B count. I tried looking at the histogram demos of gnuplot and it does seem similar in some cases, but I couldn't figure out how to make it work. Also no luck with python+matplotlib or R. Reordering the data to something like
 A B
 169 145
 164 107
 164 115
 102 120
 150 140
 100
 145
Is not a problem if needed.
 
    