create function for rectangle plot