added weight image plotting code