Optimized grid drawing in frechet diagrams