Code for Plot4