Adding flexibility to grid plot