Refactoring scatterplot class