【发布时间】:2020-04-28 08:22:36
【问题描述】:
我目前使用以下代码来绘制我的数据。:
#
#Plotting
plt.plot(temp1, densityHEX,'bo',markersize='12',label='Hexadecane MD')
plt.plot(expTempHexa,expDensHexa,'bo',markersize='12',markerfacecolor='none',label='Hexadecane Exp')
plt.plot(temp2, densityLAU,'rs',markersize='12',label='Methyl Laurate MD')
plt.plot(expTempLau2,expDensLau2,'rs',markersize='12',markerfacecolor='none',label='Methyl Laurate Exp')
plt.plot(temp2, densityMIX,'^',color='indigo',markersize='12',label='Mixture 1:1 MD')
plt.plot(expTempMix,expDensMix,'^',color='indigo',markersize='12',markerfacecolor='none',label='Mixture 1:1 Exp')
leg = plt.legend(loc='best',ncol=2,frameon=False,prop={'size': 13})
leg.get_frame().set_edgecolor('k')
plt.ylabel(r'$\rho$ (g/cm$^3$)',fontsize = 22)
plt.xlabel('T (K)',fontsize = 22)
plt.ylim((0.650,1.0))
plt.tight_layout()
plt.savefig("rhoCombined3.pdf", format='pdf')
输出是这样的:
我想知道是否有办法修改图例以获得类似的东西:
。
【问题讨论】:
-
您可以“滚动自己的”图例,但据我所知,matplotlib 开箱即用不支持这种类型的布局。
标签: python python-3.x matplotlib