[英]Graph in Python 3.5.2 with Greek Letters (LaTeX)
我是Python新手,並嘗試重現下圖:
MWE是:
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(10000)
# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green',
alpha=0.75)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
輸出為:
但是,希臘字母不能正確發送。 我可能在這里缺少一些基本知識。 如何在Python 3.5.2中重現原始圖形?
已編輯
我在Ubuntu 16.10上通過Python 2.4.1和IDLE使用了Python 3.5.2。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.