At high enough input power in stacks of Bi_2Sr_2CaCu_2O8 intrinsic Josephson
junctions a hot spot (a region heated to above the superconducting transition
temperature) coexists with regions still in the superconducting state. In the
``cold'' regions cavity resonances can occur, synchronizing the ac Josephson
currents and giving rise to strong coherent THz emission. We investigate the
interplay of hot spots and standing electromagnetic waves by low temperature
scanning laser microscopy and THz emission measurements, using stacks of
various geometries. For a rectangular and a arrow-shaped structure we show that
the standing wave can be turned on and off in various regions of the stack
structure, depending on the hot spot position. We also report on standing wave
and hot spot formation in a disk shaped mesa structure