Revert "changing diagram drawing function to return an image"

This reverts commit 22a29c37a82aaa7c670814a82f4ea4c560fd3072.