Code to generate plot4