Reorganise Grid and Lineplot code for Dash patterns