2011-01-31 3 views
2

한 그림에 약 10 개의 그림을 그려보고 있습니다. 나는 또한 전설 상자를 따로 둘 수 있었다. 그러나 범례 상자에서 글꼴 크기를 줄일 수 없습니다. 누구든지 lengend 상자에서 글꼴 크기를 줄이는 절차를 제안 할 수 있습니까?플롯에 인쇄 된 범례 상자의 텍스트 글꼴을 줄이는 방법은 무엇입니까?

본인은 사용 지침을 알려 드리지만 최종 결과에는 영향을 미치지 않습니다.

# Shink current axis's height by 10% on the bottom 
    box = ax.get_position() 
    ax.set_position([box.x0, box.y0, box.width * 0.90, box.height]) 

    # Put a legend to the right of the current axis 
    ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 1) 
    #plt.show() 

    fontP = FontProperties() 
    fontP.set_size ('x-small') 

    filename1 = "DelayCellSpur"+ str(measuredFrequencyUnderTest)+"MHz.pdf" 
    print filename1 
    plt.savefig(filename1, dpi = None, facecolor = 'w', orientation = 'portrait',bbox_inches = None) 

저는 새로운 사용자이므로 이미지를 업로드 할 수 없습니다. Pls은 범례 상자에서 글꼴 크기를 줄이는 데 도움이됩니다. 고맙습니다, 고 피

+0

언어/플랫폼을 참조하십시오? 이게 뭐야? – leppie

+0

즉각적인 답장을 보내 주셔서 감사합니다. 이것은 파이썬 언어입니다. – pottigopi

+0

장래에 태그를 달아주세요. – leppie

답변

2

매트 플롯을 사용하고 계십니까? 이 같은

뭔가 도움이 될 수

legend_font_props = FontProperties() 
legend_font_props.set_size('small') 
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), numpoints=1, prop=legend_font_props) 

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend

+0

답변 주셔서 감사합니다. 나는 당신의 대답을 시도했다, 그것은 "legend_font_props가 정의되지 않았다"라는 대답을주고있다. 여기 pls 도와 줄래? – pottigopi

+0

알다시피, 나는 첫 번째 줄에'legend_font_props = FontProperties()'변수'legend_font_props'를 작성했습니다. 또한 필자는 지금 수정해야 할 오타 ('setSize')를 만들었습니다. – 9000

+0

고마워요 .. 일하고 있어요 .. – pottigopi

관련 문제