update plotting code