Zau*_*aus 6 python latex matplotlib legend
我想在打开乳胶的情况下在一些图例标签中插入一些前导空格(问题与其他类型的标签相同)。但是,我输入的任何前导空格都将被忽略(请参阅 MWE 和下图)。一个丑陋的解决方法是输入领先.(受此问答启发)。但这并不漂亮。
知道我怎样才能让它正常工作吗?它甚至可以完成吗?或者我应该考虑提出 matplotlib 的问题吗?
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'serif'
plt.rcParams['text.usetex'] = True
plt.rcParams['mathtext.fontset'] = 'cm'
fig = plt.figure(figsize=(4, 3))
plt.plot([], label="~ tilde")
plt.plot([], label="\, comma")
plt.plot([], label="\quad quad")
plt.plot([], label="\hphantom{whitespace} hphantom")
plt.plot([], label=".\hphantom{whitespace} ugly leading dot")
plt.xlabel("\hphantom{whitespace} xlabel")
plt.legend()
Run Code Online (Sandbox Code Playgroud)