2016-10-23 6 views
2

squarify 파이썬에서 codeLink 패키지를 사용하여 treemap, wikiTreemapArticle을 그려야합니다. 이 example을 기반으로 트리 맵을 만들 수는 있지만 사각형의 레이블 글꼴 크기를 수정하는 방법을 알 수 없습니다. 스크립트의 필수 줄은 다음과 같습니다.파이썬에서 squarify로 트리 맵을 빌드 할 때 레이블 글꼴 크기를 편집하는 방법은 무엇입니까?

ax = squarify.plot(countryPop, color=colors, label=labels, ax=ax, alpha=.7) 

여기에서 'fontsize'속성을 추가 할 수 없습니다. 라벨의 크기는 어떻게 변경합니까?

답변

1

squarifymatplotlibpyplot에서 작동하므로 폰트 크기를 pyplot으로 변경하면됩니다.

플로팅 코드에서 다음 작업을 수행합니다.

SMALL_SIZE = 13 
MEDIUM_SIZE = 18 
BIGGER_SIZE = 23 

plt.rc('font', size=MEDIUM_SIZE)   # controls default text sizes 
plt.rc('axes', titlesize=BIGGER_SIZE)  # fontsize of the axes title 
plt.rc('axes', labelsize=BIGGER_SIZE)  # fontsize of the x and y labels 
plt.rc('xtick', labelsize=MEDIUM_SIZE) # fontsize of the tick labels 
plt.rc('ytick', labelsize=MEDIUM_SIZE) # fontsize of the tick labels 
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize 
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title 

이 방법 당신은 squarifytreemap 음모에 포함하여 플롯의 글꼴을 변경할 수 있습니다.