refactor plotting to separate routine
some transition refactoring