2016-06-26 2 views
0

나는 윈도우 10에서하기 matplotlib 버전 1.5.1을 사용하여 파이썬 3.4.4에서이 예제를 시도하고 표시되지 :하기 matplotlib 수학 모드 제대로

import numpy as np 
import matplotlib.pyplot as plt 
t = np.arange(0.0, 2.0, 0.01) 
s = np.sin(2*np.pi*t) 

plt.plot(t,s) 
plt.title(r'$\alpha_i > \beta_i$', fontsize=20) 
plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) 
plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', 
     fontsize=20) 
plt.xlabel('time (s)') 
plt.ylabel('volts (mV)') 
plt.show() 

(http://matplotlib.org/users/mathtext.html 참조). 그것은 다음과 같은 결과를 생성합니다

enter image description here

내가 의도 한 결과 (아래 참조)를 생산하기 위해 어떻게해야합니까?

enter image description here

+0

기본 글꼴 (예 : .matplotlibrc 파일의 'font.sans-serif')을 지나치게 넘고 있습니까? 그리스/수학 문자가 사용중인 글꼴에없는 것처럼 보입니다. – Bart

+0

그것은 작동합니다. 바트 (Bart)에 기본 글꼴 문제가 있다고 가정합니다.) – Deadpool

답변

0

글쎄, 내 사이트 - 패키지 \하기 matplotlib \ MPL-데이터 \ 글꼴 디렉토리가 손상된 것으로 밝혀졌다. 그래서 https://github.com/matplotlib/matplotlib/archive/v1.5.1.zip을 다운로드하고 글꼴 디렉토리를 거기에서 내 컴퓨터로 복사했습니다. 나는 내 사용자 디렉토리에서 .matplotlib/fontList.py3k.cache를 삭제했다. 그런 다음 모든 것이 잘 동작했다.