Jim*_*616 8 python latex matplotlib
我正在尝试显示一个图像,其标题将普通文本与几个 Latex 命令相结合:
plt.imshow(w1subtracted2, origin='lower',
extent=[l_max, -l_max, -b_max, b_max],
cmap = color_map)
plt.title('W1 disk and central $\pm2\textdegree$ subtracted', fontsize = 'small')
plt.xlabel(xlabel, fontsize = 'small')
plt.ylabel(ylabel, fontsize = 'small')
plt.savefig('w1subtracted2.png')
Run Code Online (Sandbox Code Playgroud)
但我无法获得显示\pm和的标题\textdegree以乳胶样式显示。我怎样才能做到这一点?
Imp*_*est 11
看来您使用的不是乳胶 ( usetex = True) 而是简单的 MathText。\textdegreeMathText 中没有。
使用
plt.title(r'W1 disk and central $\pm2^\circ$ subtracted', fontsize='small')
Run Code Online (Sandbox Code Playgroud)
应该给你
| 归档时间: |
|
| 查看次数: |
16061 次 |
| 最近记录: |