图matplot标签重叠

时间:2014-01-16 08:55:23

标签: python matlab graph

您好我使用下面的代码来绘制我的图表。用户可以选择阵列文件。但问题是我的图表标签很难看到。

    fig = pl.figure(figsize=(8,5))
    fig.canvas.set_window_title('Moment vs Field')     
    pl.xlabel('H (Oe)')                               
    pl.ylabel('Normalized M (M/Ms)')      
    ax1 = fig.add_subplot(111)  #Plot 1.1     
    p1,= ax1.plot(x2IP, ynewIP, '-', color='red', label = "1234")
    ax1.set_xlim((getXNegIP*1.05),(getXPosIP*1.05)) #bottom for inplane  

    ax4 = ax1.twiny()
    ax4.plot(x2IP2, ynewIP2,'-', color='red', label = "1234")
    ax4.set_xlim((getXNegIP*1.05),(getXPosIP*1.05)) # top for oop

    ax2 = ax1.twiny() #Plot 2.1
    p2, = ax2.plot(x2OP, ynewOP,'-', color='black', label = "1234")
    ax2.set_xlim((getXNegOP*1.05),(getXPosOP*1.05)) # top for oop
    ax2 = ax1.twinx()

    ax3 = ax1.twiny() # Plot 2.2
    ax3.plot(x2OP2, ynewOP2,'-', color='black', label = "1234")
    ax3.set_xlim((getXNegOP*1.05),(getXPosOP*1.05)) # top for oop

    ax4.set_ylim(-1.2,1.2)
    ax3.set_ylim(-1.2,1.2) #right for out plane
    ax2.set_ylim(-1.2,1.2) #right for out plane
    ax1.set_ylim(-1.2,1.2) # left for in plane
    pl.legend((p1, p2), [FieldNameOnlyIP, FieldNameOnlyOP], loc='lower right', prop={'size':8})       
    titleName = "Interpolate " + WaferNameIP + '  ' + WaferNameOP + '\n\n'                
    font = { 'fontname':'Calibri', 'fontsize':14 }
    matplotlib.pylab.title(titleName, **font)
    saveFilename = interpolateRH   
    saveFilename += "/Int_" + WaferNameIP + ".png" 
    pl.savefig(saveFilename,bbox_inches="tight")

标签相互重叠,很难看到。我怎样才能让它不会过度?

enter image description here

1 个答案:

答案 0 :(得分:0)

您可能正在寻找ax.set_label_position,以明确指定您想要的内容。