Adding matrix to write figures