A beam of electrons is fired at a sample. The beam causes each element in the sample to emit X-rays at a characteristic frequency; the X-rays can then be detected by the electron microprobe. The size and current density of the electron beam determines the trade-off between resolution and scan time and/or analysis time.