Cecilia Payne (1900-1979), or Cecilia Payne-Gaposchkin after her 1934 marriage, took the data from the HD Catalougue and discovered its physical significance. Payne argued that the great variation in stellar absorption lines was due to differing amounts of ionization (differing temperatures), not different abundances of elements. She correctly posited that silicon, carbon, and other common metals seen in the sun were found in about the same relative amounts as on earth but the helium and particularly hydrogen were vastly more abundant (by about a factor of one million in the case of hydrogen).
What lines you see depends primarily on the state of excitation and ionization of the gas.
These are determined primarily by the temperature of the gas.
For example, the Hydrogen absorption lines which appear in the optical region of the spectrum are created when electrons move to higher energy levels from the second excited state.
B Stars (11,000-30,000 K):
Most of H is ionized, so only very weak H lines.
A Stars (7500-11,000 K):
Ideal excitation conditions, strongest H lines.
G Stars (5200-5900 K):
Too cool, little excited H, so only weak H lines.