Typical dry type transformers vent out the front and back, cool air in the bottom and hot air out the top. #1 rule - be sure to keep the back 8 - 10 inches OFF the wall to allow for adequate ventilation.
Side to side isn't as critical but you need space for conduits in and out which generally gets them far enough apart.
RC