I read the title of your post, ie "letter frequency as function of word length" and figured that can't be too hard. So I produced the following
So what does this do? (NB on my machine tis takes around 15 secs to execute - so be patienr!)
Well it takes all the words in your specified dictionary (ospd3), and processes them into an array whose columns (1..26) represent the letters A..Z, and whose rows represent the wordlengths (0..39). The [row,column] entry is the number of times the letter (ie column) occurs in all the words of the length represented by the row entry.
Easiest way to understand this is to look at row (ignore row(0), not sure why row(0) occurs I didn't get that far! ). This represents all word of length=1 and has two non-zero entries: ans[1,1]=1 and ans[1,9]=1, which represent the exiistence of the single-letter words "A" and "I"
Now I'm pretty sure that the resulting array (ans) is correct - but I then realised it bore no "sensible" relationship to the array you were trying to achieve (and whose picture you posted). So at this point I stopped!
One way to look at what I have done is to investigate entries in the intermdeiate variable B, which is a sequence of 4-element lists, The four entries in this lists consist of
# [ letter,
You can investigate any element in this list with B[n] where n is a number between 1 and 2095886, so for example B will return ["M", "BILGY", 5, 0], whihc tells me the (useful?) information that the word "BILGY" is 5 letters long and contains the letter "M" exactly 0 times.
Having generated the sequence B, I'm pretty sure that I could organise the data you want in pretty much any way you want - but I'm just unclear aboout what you are after!????