small change to plotting code to reduce occurrence of memory errors