wrap plotting code (probably removable) in ifs

removes matplotlib dependency for testing purposes