updated to use the common py to generate figure