python codes used to create figure