extracting and generecising scatter plot creation