Stack diagrams