Matrix problem

The transistors are only slightly larger than those resistors, but they have 3 leads rather than 2. You would connect the base lead to the '595 output pin, the emitter to the led row and the collector to 5V.