Modify plot, fix problem with range in py3, add unittest