grid functions to plot matrices