Single-line diagram is a powerful tool for dispatching analysis. A new algorithm for automatically generating single-line diagram is presented. Penalty function method is adopted in the algorithm to locate stations on diagrams. A practical routing method is incorporated as well. Diagrams generated with this new algorithm are more aesthetic and practical than traditional ones. The application results are given.