我只想显示一半的误差线,因为它们是对称的;由于我不知道如何用“干净的方式”做到这一点,我选择使用底部为 0 的不对称误差;但是,当我展示大写字母时,我意识到这不是最好的方法。
这是代码:
import numpy as np
import matplotlib.pyplot as plt
N = 5
men_means = (20, 35, 30, 35, 27)
men_std = (2, 3, 4, 1, 2)
ind = np.arange(N)
width = 0.35
fig, ax = plt.subplots()
rects1 = ax.bar(ind, men_means, width, color='r',yerr=[np.zeros(len(men_std)),men_std],capsize = 5)
women_means = (25, 32, 34, 20, 25)
women_std = (3, 5, 2, 3, 3)
rects2 = ax.bar(ind + width, women_means, width, color='y',yerr=[np.zeros(len(women_std)),women_std],capsize = 5)
plt.show()
Run Code Online (Sandbox Code Playgroud)
这是我得到的情节:
. 如您所见,我绘制半误差条的方式可能不是应该做的。
那么有没有办法隐藏底部上限线或绘制半误差线的更好方法?
所以我已经尝试了几乎所有我能在 stackoverflow 上找到的东西(以及谷歌会引导我的其他任何地方);我就是不能改变该死的字体!
这是我迄今为止尝试过的非详尽清单:
按照这个问题中的建议尝试:
import matplotlib.pyplot as plt
csfont = {'fontname':'Times New Roman'}
x = [1,2,3]
y = x
plt.plot(x,y)
plt.title('Please be Times >__<',**csfont)
plt.show()
Run Code Online (Sandbox Code Playgroud)
给我这个错误日志:
>>> (executing file "<tmp 1>")
Note on using QApplication.exec_():
The GUI event loop is already running in the pyzo kernel, and exec_()
does not block. In most cases your app should run fine without the need
for modifications. For clarity, this is what the pyzo kernel does:
- Prevent deletion of …Run Code Online (Sandbox Code Playgroud)