Refactored line plotting for scaling.