plt.savefig('your_path/a/b/'+str(yname)+'_'+str(xname)+'_'+str(dimername), bbox_inches='tight', dpi=300 ) ^this is your name abc_AC (varibales) ^ crop edges