简体   繁体   中英

How do I use italicized capital Greek letters in Matplotlib

  1. $\it{\Delta}$ is useless as it will print Δ and not Δ
  2. We can use \varDelta in LaTex to get the Δ , but it is useless in Matplotlib
  3. It is inappropriate to use slanted text,because I want to print something like " Δ /mm"

You can import the Latex package amsmath and then use $\mathit{\Delta}$ in the label.

MWE:

import matplotlib
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib import rcParams

matplotlib.rc('text', usetex = True)
params = {'text.latex.preamble': [r'\usepackage{amsmath}']}   
plt.rcParams.update(params)       

fig, ax = plt.subplots()  

ax.plot([1],[1], 'bo')
ax.set_xlabel(r'$\mathit{\Delta}$/mm')
ax.set_ylabel(r'$\Delta$/mm')

plt.show()

which produces: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM