Code of plot 4 exercise