Dikes are mostly volcanic intrusions in to a preexisting rock. A dike can also be sedimentary deposits in a preexisting joint. The dike cross-cuts the preexisting rock, and is vertical to near-vertical.
Volcanic dikes appear because of the pressure, stress and deformation in the underground, leading to dikes appearing around the affected area. It is easier to recognize a dike because they cross-cut the geological column.
For both dikes and sills in volcanic rock it applies that they often create columnar joints, due to the cooling process.