refactoring in plotter