我有一张这样的图表。在
我为此编写的代码如下:header=list(outcome)
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.patches as mpatches
fig = plt.figure(figsize=(25,20))
ax = fig.add_subplot(111, projection='3d')
red_patch = mpatches.Patch(color='red', label='Terminated')
green_patch = mpatches.Patch(color='green', label='Completed Positive')
blue_patch=mpatches.Patch(color='blue', label='Completed Negative')
plt.legend(handles=[red_patch,green_patch,blue_patch],fontsize=23)
plt.title('MDS by Phase '+phase,fontsize=23)
for x, y, w, name in zip(pos[:, 0], pos[:,1], pos[:, 2], header):
if(name=='Completed Negative'):
color='blue'
elif(name=='Completed Positive'):
color='green'
else:
color='red'
ax.scatter(x, y, w,s=65,c=color)
#fig.savefig('mds_ic_'+phase+'.png')
fig.savefig('mds_obj_auto_'+phase+'.png')
我不想要黑色的背景,因为当把图形粘贴到幻灯片上时,它占用了太多的空间,但由于剩余的空间是白色的,这不是图形的一部分,所以显得很小。黑色部分与白色背景不协调