Until today I still did not know where a (scantron-required, supposedly) #2 pencil falls on this chart! The other chart in the article shows that #2=HB, which is about as confusing as the could've made it.
A confusing thing about pencil lead for test marking is that while a #2/HB hardness is usually specified, there were specially marketed pencils that were actually softer. The pencils and leads were generically branded as "mark sense". They had a higher graphite content to improve electrical conductivity, but which also made the leads softer. (Scanning machines initially used electrodes, then switched to optical sensors.) I haven't been able to test many samples, but I think "mark sense" pencils were about 4B.
Nice, cool stuff. High school hand drafting taught me a lot about the practical differences between hardness weights and their uses (e.g. center lines may require different weight than dimensions; can't remember specifics at this point). This page goes into much more detail beyond drafting as it's the page for "pencil".