Separate data formatting from plotting